v0.9.0: hero now has a reference to their enemy when using a missile wep
This commit is contained in:
parent
d4666e94b1
commit
dc10338fb4
|
@ -367,6 +367,8 @@ public class Hero extends Char {
|
|||
|
||||
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
||||
|
||||
this.enemy = enemy;
|
||||
|
||||
//temporarily set the hero's weapon to the missile weapon being used
|
||||
belongings.stashedWeapon = belongings.weapon;
|
||||
belongings.weapon = wep;
|
||||
|
@ -1052,6 +1054,8 @@ public class Hero extends Char {
|
|||
|
||||
if (wep != null) damage = wep.proc( this, enemy, damage );
|
||||
|
||||
damage = Talent.onAttackProc( this, enemy, damage );
|
||||
|
||||
switch (subClass) {
|
||||
case SNIPER:
|
||||
if (wep instanceof MissileWeapon && !(wep instanceof SpiritBow.SpiritArrow)) {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
|
@ -48,18 +47,11 @@ public class ThrowingKnife extends MissileWeapon {
|
|||
(tier == 1 ? 2*lvl : tier*lvl); //scaling unchanged
|
||||
}
|
||||
|
||||
private Char enemy;
|
||||
|
||||
@Override
|
||||
protected void onThrow(int cell) {
|
||||
enemy = Actor.findChar(cell);
|
||||
super.onThrow(cell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageRoll(Char owner) {
|
||||
if (owner instanceof Hero) {
|
||||
Hero hero = (Hero)owner;
|
||||
Char enemy = hero.enemy();
|
||||
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
|
||||
//deals 75% toward max to max on surprise, instead of min to max.
|
||||
int diff = max() - min();
|
||||
|
|
Loading…
Reference in New Issue
Block a user