v0.3.1b: refactored paralysis, now works properly when there are multiple paralysis sources
This commit is contained in:
parent
7f5e4a8d22
commit
9c861427e3
|
@ -65,7 +65,7 @@ public abstract class Char extends Actor {
|
|||
|
||||
protected float baseSpeed = 1;
|
||||
|
||||
public boolean paralysed = false;
|
||||
public int paralysed = 0;
|
||||
public boolean rooted = false;
|
||||
public boolean flying = false;
|
||||
public int invisible = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class Frost extends FlavourBuff {
|
|||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
|
||||
target.paralysed = true;
|
||||
target.paralysed++;
|
||||
Buff.detach( target, Burning.class );
|
||||
Buff.detach( target, Chill.class );
|
||||
|
||||
|
@ -89,10 +89,10 @@ public class Frost extends FlavourBuff {
|
|||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
Paralysis.unfreeze( target );
|
||||
if (Level.water[target.pos]){
|
||||
if (target.paralysed > 0)
|
||||
target.paralysed--;
|
||||
if (Level.water[target.pos])
|
||||
Buff.prolong(target, Chill.class, 4f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
|||
|
||||
if (isStarving()) {
|
||||
|
||||
if (Random.Float() < 0.3f && (target.HP > 1 || !target.paralysed)) {
|
||||
if (Random.Float() < 0.3f && (target.HP > 1 || target.paralysed == 0)) {
|
||||
|
||||
hero.damage( 1, this );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class MagicalSleep extends Buff {
|
|||
else if (target instanceof Mob)
|
||||
((Mob)target).state = ((Mob)target).SLEEPING;
|
||||
|
||||
target.paralysed = true;
|
||||
target.paralysed++;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -70,7 +70,8 @@ public class MagicalSleep extends Buff {
|
|||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
if (target.paralysed > 0)
|
||||
target.paralysed--;
|
||||
if (target instanceof Hero)
|
||||
((Hero) target).resting = false;
|
||||
super.detach();
|
||||
|
|
|
@ -36,7 +36,7 @@ public class Paralysis extends FlavourBuff {
|
|||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.paralysed = true;
|
||||
target.paralysed++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -46,7 +46,8 @@ public class Paralysis extends FlavourBuff {
|
|||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
unfreeze(target);
|
||||
if (target.paralysed > 0)
|
||||
target.paralysed--;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,12 +80,4 @@ public class Paralysis extends FlavourBuff {
|
|||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
|
||||
public static void unfreeze( Char ch ) {
|
||||
if (ch.buff( Paralysis.class ) == null &&
|
||||
ch.buff( Frost.class ) == null) {
|
||||
|
||||
ch.paralysed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
float evasion = (float)Math.pow( 1.15, bonus );
|
||||
if (paralysed) {
|
||||
if (paralysed > 0) {
|
||||
evasion /= 2;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ public class Hero extends Char {
|
|||
|
||||
super.act();
|
||||
|
||||
if (paralysed) {
|
||||
if (paralysed > 0) {
|
||||
|
||||
curAction = null;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public abstract class Mob extends Char {
|
|||
|
||||
sprite.hideAlert();
|
||||
|
||||
if (paralysed) {
|
||||
if (paralysed > 0) {
|
||||
enemySeen = false;
|
||||
spend( TICK );
|
||||
return true;
|
||||
|
@ -340,7 +340,7 @@ public abstract class Mob extends Char {
|
|||
|
||||
@Override
|
||||
public int defenseSkill( Char enemy ) {
|
||||
if (enemySeen && !paralysed) {
|
||||
if (enemySeen && paralysed == 0) {
|
||||
int defenseSkill = this.defenseSkill;
|
||||
int penalty = 0;
|
||||
for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) {
|
||||
|
|
|
@ -390,7 +390,7 @@ public class GameScene extends PixelScene {
|
|||
|
||||
Actor.process();
|
||||
|
||||
if (Dungeon.hero.ready && !Dungeon.hero.paralysed) {
|
||||
if (Dungeon.hero.ready && Dungeon.hero.paralysed == 0) {
|
||||
log.newLine();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user