mr:chaos_armor_item
Differences
This shows you the differences between two versions of the page.
| mr:chaos_armor_item [2025/12/21 17:33] – Update mr/chaos_armor_item.txt with complete code references and implementation mike | mr:chaos_armor_item [2025/12/21 21:14] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Chaos Armor Item - Code References ====== | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | * '' | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | No specific JSON configuration found for this item. | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | * '' | ||
| + | |||
| + | ===== Java Implementation ===== | ||
| + | <code java> | ||
| + | package com.nyrds.pixeldungeon.items.chaos; | ||
| + | |||
| + | import com.nyrds.Packable; | ||
| + | import com.watabou.pixeldungeon.items.armor.Armor; | ||
| + | import com.watabou.utils.Bundle; | ||
| + | |||
| + | public class ChaosArmor extends Armor { | ||
| + | |||
| + | @Packable | ||
| + | public int charge = 0; | ||
| + | |||
| + | public ChaosArmor() { | ||
| + | super( 3 ); | ||
| + | imageFile = " | ||
| + | image = 0; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean isUpgradable() { | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | private int chargeForLevel() { | ||
| + | return (int) (5 * Math.pow(level(), | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void ownerTakesDamage(int damage) { | ||
| + | charge--; | ||
| + | if(charge < 0) { | ||
| + | charge = 0; | ||
| + | } | ||
| + | |||
| + | if(level() > 3) { | ||
| + | if(charge == 0) { | ||
| + | degrade(); | ||
| + | inscribe(null); | ||
| + | charge = chargeForLevel(); | ||
| + | selectImage(); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void ownerDoesDamage(int damage) { | ||
| + | |||
| + | if(isCursed()) { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | if(damage > 0) { | ||
| + | charge++; | ||
| + | if(charge > chargeForLevel()) { | ||
| + | upgrade(true); | ||
| + | selectImage(); | ||
| + | charge = 0; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | private void selectImage() { | ||
| + | image = Math.max(0, Math.min(level()/ | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void restoreFromBundle(Bundle bundle) { | ||
| + | super.restoreFromBundle(bundle); | ||
| + | |||
| + | selectImage(); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== String Resource Excerpts ===== | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | //For other languages see:// | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * And other localized string resource files | ||
