v2.0.0: implemented the combined energy talent
This commit is contained in:
@@ -201,9 +201,22 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
public void abilityUsed( MonkAbility abil ){
|
||||
energy -= abil.energyCost();
|
||||
cooldown = abil.cooldown();
|
||||
|
||||
if (target instanceof Hero && ((Hero) target).hasTalent(Talent.COMBINED_ENERGY)
|
||||
&& abil.energyCost() >= 5-((Hero) target).pointsInTalent(Talent.COMBINED_ENERGY)) {
|
||||
Talent.CombinedEnergyAbilityTracker tracker = target.buff(Talent.CombinedEnergyAbilityTracker.class);
|
||||
if (tracker == null || tracker.wepAbilUsed == false){
|
||||
Buff.prolong(target, Talent.CombinedEnergyAbilityTracker.class, target.cooldown()).energySpent = abil.energyCost();
|
||||
} else {
|
||||
tracker.energySpent = abil.energyCost();
|
||||
processCombinedEnergy(tracker);
|
||||
}
|
||||
}
|
||||
|
||||
if (cooldown > 0 || energy < 1){
|
||||
ActionIndicator.clearAction(this);
|
||||
}
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
||||
public boolean abilitiesEmpowered( Hero hero ){
|
||||
@@ -211,6 +224,16 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
return energy/energyCap() >= 1.15f - 0.15f*hero.pointsInTalent(Talent.MONASTIC_VIGOR);
|
||||
}
|
||||
|
||||
public void processCombinedEnergy(Talent.CombinedEnergyAbilityTracker tracker){
|
||||
energy += tracker.energySpent/3f;
|
||||
cooldown = 0;
|
||||
tracker.detach();
|
||||
if (energy >= 1){
|
||||
ActionIndicator.setAction(this);
|
||||
}
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String actionName() {
|
||||
return Messages.get(this, "action");
|
||||
@@ -424,7 +447,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
}
|
||||
|
||||
if (Dungeon.level.distance(hero.pos, target) > range){
|
||||
GLog.w(Messages.get(MeleeWeapon.class, "ability_no_target"));
|
||||
GLog.w(Messages.get(MeleeWeapon.class, "ability_bad_position"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -556,8 +579,9 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
//longer to account for turns spent meditating
|
||||
public int cooldown() {
|
||||
return 6;
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -567,7 +591,6 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
GameScene.flash(0x88000000, false);
|
||||
Sample.INSTANCE.play(Assets.Sounds.SCAN);
|
||||
|
||||
Buff.affect(hero, MonkEnergy.class).abilityUsed(this);
|
||||
Buff.affect(hero, Recharging.class, 10f);
|
||||
Buff.affect(hero, ArtifactRecharge.class).prolong(10f).ignoreHornOfPlenty = false;
|
||||
for (Buff b : hero.buffs()){
|
||||
@@ -587,6 +610,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
}
|
||||
|
||||
hero.spendAndNext(5f);
|
||||
Buff.affect(hero, MonkEnergy.class).abilityUsed(this);
|
||||
}
|
||||
|
||||
public static class MeditateResistance extends FlavourBuff{};
|
||||
|
||||
@@ -277,6 +277,10 @@ public enum Talent {
|
||||
public int icon() { return BuffIndicator.CORRUPT; }
|
||||
public void tintIcon(Image icon) { icon.hardlight(0.6f, 0.15f, 0.6f); }
|
||||
};
|
||||
public static class CombinedEnergyAbilityTracker extends FlavourBuff{
|
||||
public int energySpent = -1;
|
||||
public boolean wepAbilUsed = false;
|
||||
}
|
||||
|
||||
int icon;
|
||||
int maxPoints;
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MonkEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
@@ -200,15 +201,22 @@ public class MeleeWeapon extends Weapon {
|
||||
hero.belongings.abilityWeapon = null;
|
||||
if (hero.hasTalent(Talent.COMBINED_LETHALITY)) {
|
||||
Talent.CombinedLethalityAbilityTracker tracker = hero.buff(Talent.CombinedLethalityAbilityTracker.class);
|
||||
if (tracker == null){
|
||||
if (tracker == null || tracker.weapon == this || tracker.weapon == null){
|
||||
Buff.affect(hero, Talent.CombinedLethalityAbilityTracker.class, hero.cooldown()).weapon = this;
|
||||
} else if (tracker.weapon == this || tracker.weapon == null) {
|
||||
Buff.prolong(hero, Talent.CombinedLethalityAbilityTracker.class, hero.cooldown());
|
||||
} else {
|
||||
//we triggered the talent, so remove the tracker
|
||||
tracker.detach();
|
||||
}
|
||||
}
|
||||
if (hero.hasTalent(Talent.COMBINED_ENERGY)){
|
||||
Talent.CombinedEnergyAbilityTracker tracker = hero.buff(Talent.CombinedEnergyAbilityTracker.class);
|
||||
if (tracker == null || tracker.energySpent == -1){
|
||||
Buff.prolong(hero, Talent.CombinedEnergyAbilityTracker.class, hero.cooldown()).wepAbilUsed = true;
|
||||
} else {
|
||||
tracker.wepAbilUsed = true;
|
||||
Buff.affect(hero, MonkEnergy.class).processCombinedEnergy(tracker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onAbilityKill( Hero hero ){
|
||||
|
||||
Reference in New Issue
Block a user