v0.9.1: implemented the improvised projectiles talent

This commit is contained in:
Evan Debenham 2020-11-30 14:11:31 -05:00
parent e867a4c85d
commit 69d6d6c505
2 changed files with 28 additions and 2 deletions

View File

@ -103,8 +103,11 @@ public enum Talent {
INVIGORATING_MEAL(52),
RESTORED_NATURE(53),
REJUVENATING_STEPS(54),
DURABLE_PROJECTILES(55),
HEIGHTENED_SENSES(56);
HEIGHTENED_SENSES(55),
DURABLE_PROJECTILES(56);
public static class ImprovisedProjectileCooldown extends FlavourBuff{};
public static class RejuvenatingStepsCooldown extends FlavourBuff{};
int icon;

View File

@ -26,11 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -545,6 +548,16 @@ public class Item implements Bundlable {
public void call() {
curUser = user;
Item.this.detach(user.belongings.backpack).onThrow(cell);
if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES)
&& !(Item.this instanceof MissileWeapon)
&& curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){
Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment != curUser.alignment){
Sample.INSTANCE.play(Assets.Sounds.HIT);
Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES));
Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f);
}
}
user.spendAndNext(delay);
}
});
@ -558,6 +571,16 @@ public class Item implements Bundlable {
public void call() {
curUser = user;
Item.this.detach(user.belongings.backpack).onThrow(cell);
if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES)
&& !(Item.this instanceof MissileWeapon)
&& curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){
Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment != curUser.alignment){
Sample.INSTANCE.play(Assets.Sounds.HIT);
Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES));
Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f);
}
}
user.spendAndNext(delay);
}
});