User Tools

Site Tools


mr:chaos_armor_item

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mr:chaos_armor_item [2025/12/21 17:33] – Update mr/chaos_armor_item.txt with complete code references and implementation mikemr: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 =====
 +  * ''RemixedDungeon/src/main/java/com/nyrds/pixeldungeon/items/chaos/ChaosArmor.java''
 +
 +===== JSON Configuration =====
 +No specific JSON configuration found for this item.
 +
 +===== String Resources =====
 +  * ''RemixedDungeon/src/main/res/values/strings_all.xml'' - ''ChaosArmor_Name'', ''ChaosArmor_Info''
 +
 +===== 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 = "items/chaosArmor.png";
 + image = 0;
 + }
 +
 + @Override
 + public boolean isUpgradable() {
 + return false;
 + }
 +
 + private int chargeForLevel() {
 + return (int) (5 * Math.pow(level(), 1.5));
 + }
 +
 + @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()/3, 4));
 + }
 +
 + @Override
 + public void restoreFromBundle(Bundle bundle) {
 + super.restoreFromBundle(bundle);
 +
 + selectImage();
 + }
 +}
 +</code>
 +
 +===== String Resource Excerpts =====
 +<code xml>
 +<string name="ChaosArmor_Name">Chaos armor</string>
 +<string name="ChaosArmor_Info">This armor consists of blood-red plates that are sewed together with dark red chains. They irradiate chaotic energy as you touch them.</string>
 +</code>
 +
 +//For other languages see://
 +  * ''values-ru/strings_all.xml''
 +  * ''values-de/strings_all.xml''
 +  * ''values-es/strings_all.xml''
 +  * And other localized string resource files