diff --git a/.gitignore b/.gitignore index 2114a15c5..9fb4a8605 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ desktop/replay_pid21216.log desktop/replay_pid7460.log core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass$1.smali core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/ColdChestBossLevel.smali +gradle.properties diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java index 81ad5c50f..2e0de30b7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java @@ -120,6 +120,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.IceFishSword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.LifeTreeSword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.LockSword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagicTorch; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RedBloodMoon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.SDBSword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.SkyShield; @@ -185,6 +186,7 @@ public enum HeroClass { new Gauntlet().quantity(1).identify().collect(); new WashCrime().quantity(1).identify().collect(); + new MagicTorch().quantity(1).identify().collect(); new Cake().quantity(100).identify().collect(); new TengusMask().quantity(1).identify().collect(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagicTorch.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagicTorch.java new file mode 100644 index 000000000..03fea9dfc --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagicTorch.java @@ -0,0 +1,98 @@ +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; + +import static com.shatteredpixel.shatteredpixeldungeon.Dungeon.hero; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + + +/** + * 魔法火把 + */ +public class MagicTorch extends MeleeWeapon { + + /** + * 重写父类的属性 + * @param tier 等级 + * @param image 图片 + * @param ACC 命中率 + */ { + image = ItemSpriteSheet.MAGIC_TORCH; + tier = 2; + ACC = 0.8f; + } + + /** + * 重写父类的方法 + * + * @param lvl 等级 + * @return 最小伤害 + */ + @Override + public int max(int lvl) { + return 5 * (tier) + //base + lvl * (tier + 1); //level scaling + } + + /** + * 重写父类的方法 + * + * @param lvl 等级 + * @return 最大伤害 + */ + @Override + public int STRReq(int lvl) { + return (7 + tier * 2) - (int) (Math.sqrt(8 * lvl + 1) - 1) / 2; + //19 base strength req, up from 18 + } + + /** + * 重写父类的方法 + * + * @param hero 英雄 + * @param action 动作 + */ + @Override + public void execute(Hero hero, String action) { + super.execute(hero, action); + //当英雄使用魔法火把时,给英雄添加一个光环buff,光环buff会对周围的敌人造成伤害,伤害值为英雄的魔法火把的最大伤害值,持续时间为5回合,每回合造成一次伤害,伤害值为英雄的魔法火把的最大伤害值,光环buff的名称为“光环” + if (action.equals(AC_EQUIP)) { + //In addition to equipping itself, item reassigns itself to the quickslot + //This is a special case as the item is being removed from inventory, but is staying with the hero. + int slot = Dungeon.quickslot.getSlot(this); + doEquip(hero); + if (slot != -1) { + Dungeon.quickslot.setSlot(slot, this); + updateQuickslot(); + } + //Buff.affect(hero, LighS.class); + } else if (action.equals(AC_UNEQUIP)) { + doUnequip(hero, true); + //Buff.detach(hero, LighS.class); + } + } + + /** + * 重写父类的proc方法 + * + * @param attacker 攻击者 + * @param defender 防御者 + * @param damage 伤害 + */ + @Override + public int proc(Char attacker, Char defender, int damage) { + /** + * @param defender 防御者 + * @param Burning.class 伤害类型 + * @param hero 伤害来源 + * @param 4f + level() / 5f 伤害值 + */ + Buff.affect(defender, Burning.class).reignite(hero, 4f + level() / 5f); + + return super.proc(attacker, defender, damage); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index c8d809dd5..869415004 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -208,6 +208,7 @@ public class ItemSpriteSheet { public static final int RAPIER = WEP_TIER1+3; public static final int DAGGER = WEP_TIER1+4; public static final int MAGES_STAFF = WEP_TIER1+5; + public static final int MAGIC_TORCH = WEP_TIER1+6; static{ assignItemRect(WORN_SHORTSWORD, 13, 13); assignItemRect(GLOVES, 12, 16); diff --git a/gradle.properties b/gradle.properties index b61505764..95d128a89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx1024m -XX:MaxPermSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit