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;
|
protected float baseSpeed = 1;
|
||||||
|
|
||||||
public boolean paralysed = false;
|
public int paralysed = 0;
|
||||||
public boolean rooted = false;
|
public boolean rooted = false;
|
||||||
public boolean flying = false;
|
public boolean flying = false;
|
||||||
public int invisible = 0;
|
public int invisible = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class Frost extends FlavourBuff {
|
||||||
public boolean attachTo( Char target ) {
|
public boolean attachTo( Char target ) {
|
||||||
if (super.attachTo( target )) {
|
if (super.attachTo( target )) {
|
||||||
|
|
||||||
target.paralysed = true;
|
target.paralysed++;
|
||||||
Buff.detach( target, Burning.class );
|
Buff.detach( target, Burning.class );
|
||||||
Buff.detach( target, Chill.class );
|
Buff.detach( target, Chill.class );
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ public class Frost extends FlavourBuff {
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
super.detach();
|
super.detach();
|
||||||
Paralysis.unfreeze( target );
|
if (target.paralysed > 0)
|
||||||
if (Level.water[target.pos]){
|
target.paralysed--;
|
||||||
|
if (Level.water[target.pos])
|
||||||
Buff.prolong(target, Chill.class, 4f);
|
Buff.prolong(target, Chill.class, 4f);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
if (isStarving()) {
|
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 );
|
hero.damage( 1, this );
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class MagicalSleep extends Buff {
|
||||||
else if (target instanceof Mob)
|
else if (target instanceof Mob)
|
||||||
((Mob)target).state = ((Mob)target).SLEEPING;
|
((Mob)target).state = ((Mob)target).SLEEPING;
|
||||||
|
|
||||||
target.paralysed = true;
|
target.paralysed++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +70,8 @@ public class MagicalSleep extends Buff {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
target.paralysed = false;
|
if (target.paralysed > 0)
|
||||||
|
target.paralysed--;
|
||||||
if (target instanceof Hero)
|
if (target instanceof Hero)
|
||||||
((Hero) target).resting = false;
|
((Hero) target).resting = false;
|
||||||
super.detach();
|
super.detach();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Paralysis extends FlavourBuff {
|
||||||
@Override
|
@Override
|
||||||
public boolean attachTo( Char target ) {
|
public boolean attachTo( Char target ) {
|
||||||
if (super.attachTo( target )) {
|
if (super.attachTo( target )) {
|
||||||
target.paralysed = true;
|
target.paralysed++;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -46,7 +46,8 @@ public class Paralysis extends FlavourBuff {
|
||||||
@Override
|
@Override
|
||||||
public void detach() {
|
public void detach() {
|
||||||
super.detach();
|
super.detach();
|
||||||
unfreeze(target);
|
if (target.paralysed > 0)
|
||||||
|
target.paralysed--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,12 +80,4 @@ public class Paralysis extends FlavourBuff {
|
||||||
Resistance r = ch.buff( Resistance.class );
|
Resistance r = ch.buff( Resistance.class );
|
||||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
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 );
|
float evasion = (float)Math.pow( 1.15, bonus );
|
||||||
if (paralysed) {
|
if (paralysed > 0) {
|
||||||
evasion /= 2;
|
evasion /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class Hero extends Char {
|
||||||
|
|
||||||
super.act();
|
super.act();
|
||||||
|
|
||||||
if (paralysed) {
|
if (paralysed > 0) {
|
||||||
|
|
||||||
curAction = null;
|
curAction = null;
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ public abstract class Mob extends Char {
|
||||||
|
|
||||||
sprite.hideAlert();
|
sprite.hideAlert();
|
||||||
|
|
||||||
if (paralysed) {
|
if (paralysed > 0) {
|
||||||
enemySeen = false;
|
enemySeen = false;
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
return true;
|
return true;
|
||||||
|
@ -340,7 +340,7 @@ public abstract class Mob extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int defenseSkill( Char enemy ) {
|
public int defenseSkill( Char enemy ) {
|
||||||
if (enemySeen && !paralysed) {
|
if (enemySeen && paralysed == 0) {
|
||||||
int defenseSkill = this.defenseSkill;
|
int defenseSkill = this.defenseSkill;
|
||||||
int penalty = 0;
|
int penalty = 0;
|
||||||
for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) {
|
for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) {
|
||||||
|
|
|
@ -390,7 +390,7 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
Actor.process();
|
Actor.process();
|
||||||
|
|
||||||
if (Dungeon.hero.ready && !Dungeon.hero.paralysed) {
|
if (Dungeon.hero.ready && Dungeon.hero.paralysed == 0) {
|
||||||
log.newLine();
|
log.newLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user