v0.9.2: artifact charging can now affect unequipped artifacts

This commit is contained in:
Evan Debenham
2021-02-20 18:17:53 -05:00
parent ee4381420b
commit 5e6eeef645
5 changed files with 16 additions and 19 deletions

View File

@@ -21,10 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
@@ -43,24 +41,16 @@ public class ArtifactRecharge extends Buff {
@Override
public boolean act() {
if (target instanceof Hero){
Belongings b = ((Hero) target).belongings;
if (target instanceof Hero) {
float chargeAmount = Math.min(1, left);
if (b.artifact instanceof Artifact){
if (!(b.artifact instanceof HornOfPlenty) || !ignoreHornOfPlenty) {
((Artifact) b.artifact).charge((Hero) target, chargeAmount);
}
}
if (b.misc instanceof Artifact){
if (!(b.misc instanceof HornOfPlenty) || !ignoreHornOfPlenty) {
((Artifact) b.misc).charge((Hero) target, chargeAmount);
for (Buff b : target.buffs()) {
if (b instanceof Artifact.ArtifactBuff) {
((Artifact.ArtifactBuff) b).charge((Hero) target, chargeAmount);
}
}
}
left--;
if (left <= 0){
detach();

View File

@@ -224,6 +224,10 @@ public class Artifact extends KindofMisc {
return cursed;
}
public void charge(Hero target, float amount){
Artifact.this.charge(target, amount);
}
}
private static final String EXP = "exp";

View File

@@ -170,6 +170,7 @@ public class CloakOfShadows extends Artifact {
@Override
public void charge(Hero target, float amount) {
if (charge < chargeCap) {
if (!isEquipped(target)) amount *= target.pointsInTalent(Talent.LIGHT_CLOAK)/10f;
partialCharge += 0.25f*amount;
if (partialCharge >= 1){
partialCharge--;

View File

@@ -58,8 +58,9 @@ public class WildEnergy extends TargetedSpell {
ScrollOfRecharging.charge(hero);
hero.belongings.charge(1f);
if (hero.belongings.artifact instanceof Artifact) ((Artifact) hero.belongings.artifact).charge(hero, 4);
if (hero.belongings.misc instanceof Artifact) ((Artifact) hero.belongings.misc).charge(hero, 4);
for (Buff b : hero.buffs()){
if (b instanceof Artifact.ArtifactBuff) ((Artifact.ArtifactBuff) b).charge(hero, 4);
}
Buff.affect(hero, Recharging.class, 8f);
Buff.affect(hero, ArtifactRecharge.class).prolong( 8 ).ignoreHornOfPlenty = false;

View File

@@ -159,8 +159,9 @@ public class MagesStaff extends MeleeWeapon {
if (attacker instanceof Hero && ((Hero) attacker).hasTalent(Talent.MYSTICAL_CHARGE)){
Hero hero = (Hero) attacker;
if (hero.belongings.artifact instanceof Artifact) ((Artifact) hero.belongings.artifact).charge(hero, hero.pointsInTalent(Talent.MYSTICAL_CHARGE)/2f);
if (hero.belongings.misc instanceof Artifact) ((Artifact) hero.belongings.misc).charge(hero, hero.pointsInTalent(Talent.MYSTICAL_CHARGE)/2f);
for (Buff b : hero.buffs()){
if (b instanceof Artifact.ArtifactBuff) ((Artifact.ArtifactBuff) b).charge(hero, hero.pointsInTalent(Talent.MYSTICAL_CHARGE)/2f);
}
}
if (wand != null &&