v0.9.2: implemented the shared enchantment talent

This commit is contained in:
Evan Debenham 2021-02-07 14:49:30 -05:00
parent 041046cc74
commit d8f906308c
4 changed files with 29 additions and 4 deletions

View File

@ -417,6 +417,8 @@ actors.hero.talent.point_blank.title=point blank
actors.hero.talent.point_blank.desc=_+1:_ When the Huntress uses a thrown weapon at melee range it has _-30% accuracy,_ instead of -50%.\n\n_+2:_ When the Huntress uses a thrown weapon at melee range it has _-10% accuracy,_ instead of -50%.\n\n_+3:_ When the Huntress uses a thrown weapon at melee range it has _+10% accuracy,_ instead of -50%.\n\nNote that thrown weapons always have +50% accuracy when used at a distance.
actors.hero.talent.farsight.title=farsight
actors.hero.talent.farsight.desc=_+1:_ The Sniper's vision range is _increased by 25%_\n\n_+2:_ The Sniper's vision range is _increased by 50%_\n\n_+3:_ The Sniper's vision range is _increased by 75%_
actors.hero.talent.shared_enchantment.title=shared enchantment
actors.hero.talent.shared_enchantment.desc=_+1:_ Thrown weapons have a _33% chance_ to use the enchantment on the Sniper's bow.\n\n_+2:_ Thrown weapons have a _67% chance_ to use the enchantment on the Sniper's bow.\n\n_+3:_ Thrown weapons have a _100% chance_ to use the enchantment on the Sniper's bow.\n\nThis talent does not apply to darts shot from an enchanted crossbow, they already trigger the crossbow's enchantment.
actors.hero.talent.durable_tips.title=durable tips
actors.hero.talent.durable_tips.desc=_+1:_ Tipped darts have _2x durability_ when the Warden uses them.\n\n_+2:_ Tipped darts have _3x durability_ when the Warden uses them.\n\n_+3:_ Tipped darts have _4x durability_ when the Warden uses them.
actors.hero.talent.barkskin.title=barkskin

View File

@ -106,7 +106,7 @@ public enum Talent {
//Huntress T3
POINT_BLANK(105, 3), HUNTRESS_T3_2(106, 3),
//Sniper T3
FARSIGHT(107, 3), SNIPER_T3_2(108, 3), SNIPER_T3_3(109, 3),
FARSIGHT(107, 3), SHARED_ENCHANTMENT(108, 3), SNIPER_T3_3(109, 3),
//Warden T3
DURABLE_TIPS(110, 3), BARKSKIN(111, 3), WARDEN_T3_3(112, 3);
@ -476,7 +476,7 @@ public enum Talent {
Collections.addAll(tierTalents, EVASIVE_ARMOR, PROJECTILE_MOMENTUM, FREERUNNER_T3_3);
break;
case SNIPER:
Collections.addAll(tierTalents, FARSIGHT, SNIPER_T3_2, SNIPER_T3_3);
Collections.addAll(tierTalents, FARSIGHT, SHARED_ENCHANTMENT, SNIPER_T3_3);
break;
case WARDEN:
Collections.addAll(tierTalents, DURABLE_TIPS, BARKSKIN, WARDEN_T3_3);

View File

@ -26,6 +26,7 @@ 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.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -34,8 +35,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
@ -182,7 +185,23 @@ abstract public class MissileWeapon extends Weapon {
}
}
}
@Override
public int proc(Char attacker, Char defender, int damage) {
if (attacker == Dungeon.hero && Random.Int(3) < Dungeon.hero.pointsInTalent(Talent.SHARED_ENCHANTMENT)){
if (this instanceof Dart && ((Dart) this).crossbowHasEnchant(Dungeon.hero)){
//do nothing
} else {
SpiritBow bow = Dungeon.hero.belongings.getItem(SpiritBow.class);
if (bow != null && bow.enchantment != null && Dungeon.hero.buff(MagicImmune.class) == null) {
damage = bow.enchantment.proc(this, attacker, defender, damage);
}
}
}
return super.proc(attacker, defender, damage);
}
@Override
public Item random() {
if (!stackable) return this;

View File

@ -101,6 +101,10 @@ public class Dart extends MissileWeapon {
bow = null;
}
}
public boolean crossbowHasEnchant( Char owner ){
return bow != null && bow.enchantment != null && owner.buff(MagicImmune.class) == null;
}
@Override
public boolean hasEnchant(Class<? extends Enchantment> type, Char owner) {
@ -115,7 +119,7 @@ public class Dart extends MissileWeapon {
public int proc(Char attacker, Char defender, int damage) {
if (bow != null && bow.enchantment != null && attacker.buff(MagicImmune.class) == null){
level(bow.level());
damage = bow.enchantment.proc(this, attacker, defender, damage);
damage = bow.enchantment.proc(bow, attacker, defender, damage);
level(0);
}
return super.proc(attacker, defender, damage);