v2.0.0: adjusted pickaxe code and gave it a duelist ability

This commit is contained in:
Evan Debenham
2022-11-24 17:14:43 -05:00
parent e58eb00e2a
commit 84044fa658
3 changed files with 77 additions and 28 deletions
@@ -842,7 +842,9 @@ items.quest.metalshard.desc=A shard of rusted cursed metal, which broke off DM-3
items.quest.pickaxe.name=pickaxe
items.quest.pickaxe.ac_mine=MINE
items.quest.pickaxe.no_vein=There is no dark gold vein near you to mine.
items.quest.pickaxe.desc=This is a large and sturdy tool for breaking rocks. Probably it can be used as a weapon.
items.quest.pickaxe.ability_name=smash
items.quest.pickaxe.ability_desc=The duelist can _smash_ an enemy with a pickaxe. This is guaranteed to hit, applies vulnerable for 3 turns, and deals double damage to enemies with rigid skin.
items.quest.pickaxe.desc=This is a sturdy and heavy tool for breaking rocks. It can probably be used as a weapon in a pinch.
items.quest.ratskull.name=giant rat skull
items.quest.ratskull.desc=A surprisingly large rat skull. It would make a great hunting trophy, if you had a wall to mount it on.
@@ -99,6 +99,7 @@ public class Blacksmith extends NPC {
Notes.add( Notes.Landmark.TROLL );
Pickaxe pick = new Pickaxe();
pick.identify();
if (pick.doPickUp( Dungeon.hero )) {
GLog.i( Messages.capitalize(Messages.get(Dungeon.hero, "you_now_have", pick.name()) ));
} else {
@@ -25,11 +25,21 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bat;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Crab;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Scorpio;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Spinner;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RunicBlade;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@@ -44,7 +54,7 @@ import com.watabou.utils.PathFinder;
import java.util.ArrayList;
public class Pickaxe extends Weapon {
public class Pickaxe extends MeleeWeapon {
public static final String AC_MINE = "MINE";
@@ -59,26 +69,15 @@ public class Pickaxe extends Weapon {
unique = true;
bones = false;
defaultAction = AC_MINE;
tier = 2;
}
public boolean bloodStained = false;
@Override
public int min(int lvl) {
return 2; //tier 2
}
@Override
public int max(int lvl) {
return 15; //tier 2
}
@Override
public int STRReq(int lvl) {
return STRReq(3, lvl); //tier 3
return super.STRReq(lvl) + 2; //tier 3 strength requirement with tier 2 damage stats
}
@Override
@@ -139,16 +138,6 @@ public class Pickaxe extends Weapon {
}
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
@Override
public int proc( Char attacker, Char defender, int damage ) {
if (!bloodStained && defender instanceof Bat) {
@@ -170,9 +159,62 @@ public class Pickaxe extends Weapon {
}
});
}
return damage;
return super.proc( attacker, defender, damage );
}
@Override
public String defaultAction() {
if (Dungeon.hero.heroClass == HeroClass.DUELIST && isEquipped(Dungeon.hero)){
return AC_ABILITY;
} else {
return AC_MINE;
}
}
@Override
public String targetingPrompt() {
return Messages.get(this, "prompt");
}
@Override
protected void duelistAbility(Hero hero, Integer target) {
if (target == null) {
return;
}
Char enemy = Actor.findChar(target);
if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]) {
GLog.w(Messages.get(this, "ability_no_target"));
return;
}
if (!hero.canAttack(enemy)){
GLog.w(Messages.get(this, "ability_bad_position"));
return;
}
hero.sprite.attack(enemy.pos, new Callback() {
@Override
public void call() {
float damageMulti = 1f;
if (Char.hasProp(enemy, Char.Property.INORGANIC)
|| enemy instanceof Swarm
|| enemy instanceof Crab
|| enemy instanceof Spinner
|| enemy instanceof Scorpio) {
damageMulti = 2f;
}
hero.attack(enemy, damageMulti, 0, Char.INFINITE_ACCURACY);
if (enemy.isAlive()){
Buff.affect(enemy, Vulnerable.class, 3f);
}
onAbilityUsed(hero);
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
hero.spendAndNext(hero.attackDelay());
}
});
}
private static final String BLOODSTAINED = "bloodStained";
@Override
@@ -191,7 +233,11 @@ public class Pickaxe extends Weapon {
@Override
public Glowing glowing() {
return bloodStained ? BLOODY : null;
if (super.glowing() == null) {
return bloodStained ? BLOODY : null;
} else {
return super.glowing();
}
}
}