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 ) {
|
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
||||||
|
|
||||||
|
this.enemy = enemy;
|
||||||
|
|
||||||
//temporarily set the hero's weapon to the missile weapon being used
|
//temporarily set the hero's weapon to the missile weapon being used
|
||||||
belongings.stashedWeapon = belongings.weapon;
|
belongings.stashedWeapon = belongings.weapon;
|
||||||
belongings.weapon = wep;
|
belongings.weapon = wep;
|
||||||
|
@ -1051,6 +1053,8 @@ public class Hero extends Char {
|
||||||
KindOfWeapon wep = belongings.weapon;
|
KindOfWeapon wep = belongings.weapon;
|
||||||
|
|
||||||
if (wep != null) damage = wep.proc( this, enemy, damage );
|
if (wep != null) damage = wep.proc( this, enemy, damage );
|
||||||
|
|
||||||
|
damage = Talent.onAttackProc( this, enemy, damage );
|
||||||
|
|
||||||
switch (subClass) {
|
switch (subClass) {
|
||||||
case SNIPER:
|
case SNIPER:
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
|
@ -48,18 +47,11 @@ public class ThrowingKnife extends MissileWeapon {
|
||||||
(tier == 1 ? 2*lvl : tier*lvl); //scaling unchanged
|
(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
|
@Override
|
||||||
public int damageRoll(Char owner) {
|
public int damageRoll(Char owner) {
|
||||||
if (owner instanceof Hero) {
|
if (owner instanceof Hero) {
|
||||||
Hero hero = (Hero)owner;
|
Hero hero = (Hero)owner;
|
||||||
|
Char enemy = hero.enemy();
|
||||||
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
|
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
|
||||||
//deals 75% toward max to max on surprise, instead of min to max.
|
//deals 75% toward max to max on surprise, instead of min to max.
|
||||||
int diff = max() - min();
|
int diff = max() - min();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user