v3.3.5: fixed cases where friendly tipped darts could still deal dmg
This commit is contained in:
@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class AdrenalineDart extends TippedDart {
|
||||
@@ -32,7 +33,17 @@ public class AdrenalineDart extends TippedDart {
|
||||
{
|
||||
image = ItemSpriteSheet.ADRENALINE_DART;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int damageRoll(Char owner) {
|
||||
if (owner instanceof Hero) {
|
||||
if (((Hero) owner).attackTarget().alignment == owner.alignment){
|
||||
return 0; //does not deal damage to allies
|
||||
}
|
||||
}
|
||||
return super.damageRoll(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int proc(Char attacker, Char defender, int damage) {
|
||||
|
||||
@@ -40,7 +51,6 @@ public class AdrenalineDart extends TippedDart {
|
||||
//do nothing to the hero when processing charged shot
|
||||
} else if (attacker.alignment == defender.alignment){
|
||||
Buff.prolong( defender, Adrenaline.class, Adrenaline.DURATION);
|
||||
return 0;
|
||||
} else {
|
||||
Buff.prolong( defender, Cripple.class, Cripple.DURATION/2);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow;
|
||||
@@ -36,7 +37,17 @@ public class CleansingDart extends TippedDart {
|
||||
{
|
||||
image = ItemSpriteSheet.CLEANSING_DART;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int damageRoll(Char owner) {
|
||||
if (owner instanceof Hero) {
|
||||
if (((Hero) owner).attackTarget().alignment == owner.alignment){
|
||||
return 0; //does not deal damage to allies
|
||||
}
|
||||
}
|
||||
return super.damageRoll(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int proc(Char attacker, final Char defender, int damage) {
|
||||
|
||||
@@ -44,7 +55,6 @@ public class CleansingDart extends TippedDart {
|
||||
//do nothing to the hero when processing charged shot
|
||||
} else if (attacker.alignment == defender.alignment){
|
||||
PotionOfCleansing.cleanse(defender, PotionOfCleansing.Cleanse.DURATION*2f);
|
||||
return 0;
|
||||
} else {
|
||||
for (Buff b : defender.buffs()){
|
||||
if (!(b instanceof ChampionEnemy)
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
@@ -33,7 +34,17 @@ public class HealingDart extends TippedDart {
|
||||
image = ItemSpriteSheet.HEALING_DART;
|
||||
usesTargeting = false; //you never want to throw this at an enemy
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int damageRoll(Char owner) {
|
||||
if (owner instanceof Hero) {
|
||||
if (((Hero) owner).attackTarget().alignment == owner.alignment){
|
||||
return 0; //does not deal damage to allies
|
||||
}
|
||||
}
|
||||
return super.damageRoll(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int proc(Char attacker, Char defender, int damage) {
|
||||
|
||||
@@ -45,11 +56,7 @@ public class HealingDart extends TippedDart {
|
||||
//heals 30 hp at base, scaling with enemy HT
|
||||
PotionOfHealing.cure( defender );
|
||||
Buff.affect( defender, Healing.class ).setHeal((int)(0.5f*defender.HT + 30), 0.25f, 0);
|
||||
|
||||
if (attacker.alignment == defender.alignment){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return super.proc(attacker, defender, damage);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
@@ -36,6 +37,16 @@ public class HolyDart extends TippedDart {
|
||||
{
|
||||
image = ItemSpriteSheet.HOLY_DART;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll(Char owner) {
|
||||
if (owner instanceof Hero) {
|
||||
if (((Hero) owner).attackTarget().alignment == owner.alignment){
|
||||
return 0; //does not deal damage to allies
|
||||
}
|
||||
}
|
||||
return super.damageRoll(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int proc(Char attacker, Char defender, int damage) {
|
||||
@@ -47,7 +58,6 @@ public class HolyDart extends TippedDart {
|
||||
|
||||
if (attacker.alignment == defender.alignment){
|
||||
Buff.affect(defender, Bless.class, Math.round(Bless.DURATION));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Char.hasProp(defender, Char.Property.UNDEAD) || Char.hasProp(defender, Char.Property.DEMONIC)){
|
||||
|
||||
Reference in New Issue
Block a user