v0.8.0: formalized cases where attacks should always miss or always hit

This commit is contained in:
Evan Debenham 2019-12-02 23:57:48 -05:00
parent 826b33a59d
commit 07db857bf8
10 changed files with 40 additions and 16 deletions

View File

@ -316,12 +316,26 @@ public abstract class Char extends Actor {
} }
} }
public static int INFINITE_ACCURACY = 1_000_000;
public static int INFINITE_EVASION = 1_000_000;
public static boolean hit( Char attacker, Char defender, boolean magic ) { public static boolean hit( Char attacker, Char defender, boolean magic ) {
float acuRoll = Random.Float( attacker.attackSkill( defender ) ); float acuStat = attacker.attackSkill( defender );
float defStat = defender.defenseSkill( attacker );
//if accuracy or evasion are large enough, treat them as infinite.
//note that infinite evasion beats infinite accuracy
if (defStat >= INFINITE_EVASION){
return false;
} else if (acuStat >= INFINITE_ACCURACY){
return true;
}
float acuRoll = Random.Float( acuStat );
if (attacker.buff(Bless.class) != null) acuRoll *= 1.25f; if (attacker.buff(Bless.class) != null) acuRoll *= 1.25f;
if (attacker.buff( Hex.class) != null) acuRoll *= 0.8f; if (attacker.buff( Hex.class) != null) acuRoll *= 0.8f;
float defRoll = Random.Float( defender.defenseSkill( attacker ) ); float defRoll = Random.Float( defStat );
if (defender.buff(Bless.class) != null) defRoll *= 1.25f; if (defender.buff(Bless.class) != null) defRoll *= 1.25f;
if (defender.buff( Hex.class) != null) defRoll *= 0.8f; if (defender.buff( Hex.class) != null) defRoll *= 0.8f;

View File

@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
@ -207,6 +208,15 @@ public class Combo extends Buff implements ActionIndicator.Action {
AttackIndicator.target(enemy); AttackIndicator.target(enemy);
if (enemy.defenseSkill(target) >= Char.INFINITE_EVASION){
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
Sample.INSTANCE.play(Assets.SND_MISS);
detach();
ActionIndicator.clearAction(Combo.this);
((Hero)target).spendAndNext(((Hero)target).attackDelay());
return;
}
int dmg = target.damageRoll(); int dmg = target.damageRoll();
//variance in damage dealt //variance in damage dealt

View File

@ -104,10 +104,10 @@ public class Monk extends Mob {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
if (buff(Focus.class) != null){ if (buff(Focus.class) != null && paralysed == 0 && state != SLEEPING){
return 100_000_000; return INFINITE_EVASION;
} }
return 0; //testing return super.defenseSkill( enemy );
} }
@Override @Override

View File

@ -243,7 +243,7 @@ public class Blacksmith extends NPC {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -81,7 +81,7 @@ public class Ghost extends NPC {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -72,7 +72,7 @@ public class Imp extends NPC {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -37,7 +37,7 @@ public class RatKing extends NPC {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -58,7 +58,7 @@ public class Sheep extends NPC {
@Override @Override
public int defenseSkill(Char enemy) { public int defenseSkill(Char enemy) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -66,7 +66,7 @@ public class Wandmaker extends NPC {
@Override @Override
public int defenseSkill( Char enemy ) { public int defenseSkill( Char enemy ) {
return 100_000_000; return INFINITE_EVASION;
} }
@Override @Override

View File

@ -39,7 +39,7 @@ actors.blobs.waterofhealth.desc=Power of health radiates from the water of this
actors.blobs.wateroftransmutation.desc=Power of change radiates from the water of this well. Throw an item into the well to turn it into something else. actors.blobs.wateroftransmutation.desc=Power of change radiates from the water of this well. Throw an item into the well to turn it into something else.
actors.blobs.web.desc=A thick web is covering everything here. Anything that touches or is thrown though the web will break it, but will also be stuck in place. actors.blobs.web.desc=A thick web is covering everything here. Anything that touches or is thrown through the web will break it, but will also be stuck in place.
@ -504,7 +504,7 @@ actors.mobs.fetidrat.name=fetid rat
actors.mobs.fetidrat.desc=Something is clearly wrong with this rat. Its greasy black fur and rotting skin are very different from the healthy rats you've seen previously. Its pale green eyes make it seem especially menacing.\n\nThe rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\nDark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water. actors.mobs.fetidrat.desc=Something is clearly wrong with this rat. Its greasy black fur and rotting skin are very different from the healthy rats you've seen previously. Its pale green eyes make it seem especially menacing.\n\nThe rat carries a cloud of horrible stench with it, it's overpoweringly strong up close.\n\nDark ooze dribbles from the rat's mouth, it eats through the floor but seems to dissolve in water.
actors.mobs.ghoul.name=dwarven ghoul actors.mobs.ghoul.name=dwarven ghoul
actors.mobs.ghoul.desc=As dwarven society slowly began to collapse, and the current king of the dwarves siezed absolute power, those who were weak or who resisted him were not treated well. As the king grew more adept at weilding dark magic, he bent these dwarves to his will, and now they make up the footsoldiers of his army.\n\nGhouls are not especially strong on their own, but always travel in groups, attempting to overwhelm their opponent with greater numbers. actors.mobs.ghoul.desc=As dwarven society slowly began to collapse, and the current king of the dwarves seized absolute power, those who were weak or who resisted him were not treated well. As the king grew more adept at weilding dark magic, he bent these dwarves to his will, and now they make up the footsoldiers of his army.\n\nGhouls are not especially strong on their own, but always travel in groups, attempting to overwhelm their opponent with greater numbers.
actors.mobs.gnoll.name=gnoll scout actors.mobs.gnoll.name=gnoll scout
actors.mobs.gnoll.desc=Gnolls are hyena-like humanoids. They dwell in sewers and dungeons, venturing up to raid the surface from time to time. Gnoll scouts are regular members of their pack, they are not as strong as brutes and not as intelligent as shamans. actors.mobs.gnoll.desc=Gnolls are hyena-like humanoids. They dwell in sewers and dungeons, venturing up to raid the surface from time to time. Gnoll scouts are regular members of their pack, they are not as strong as brutes and not as intelligent as shamans.
@ -592,7 +592,7 @@ actors.mobs.senior.name=senior monk
actors.mobs.senior.desc=These monks are fanatics, who have devoted themselves to protecting their king through physical might. So great is their devotion that they have totally surrendered their minds to their king, and now roam the dwarvern city like mindless zombies.\n\nThis monk has mastered the art of hang-to-hand combat, and is able to gain focus while moving much more quickly than regular monks. When they become focused, monks will parry the next physical attack used against them, even if it was otherwise guaranteed to hit. Monks build focus more quickly while on the move, and more slowly when in direct combat. actors.mobs.senior.desc=These monks are fanatics, who have devoted themselves to protecting their king through physical might. So great is their devotion that they have totally surrendered their minds to their king, and now roam the dwarvern city like mindless zombies.\n\nThis monk has mastered the art of hang-to-hand combat, and is able to gain focus while moving much more quickly than regular monks. When they become focused, monks will parry the next physical attack used against them, even if it was otherwise guaranteed to hit. Monks build focus more quickly while on the move, and more slowly when in direct combat.
actors.mobs.shaman.name=gnoll shaman actors.mobs.shaman.name=gnoll shaman
actors.mobs.shaman.zap_kill=The lightning bolt killed you... actors.mobs.shaman.bolt_kill=The magic bolt killed you...
actors.mobs.shaman.desc=Gnoll shamans are intelligent gnolls who use battle spells to compensate for their lack of might. They have a very respected position in gnoll society, despite their weaker strength. actors.mobs.shaman.desc=Gnoll shamans are intelligent gnolls who use battle spells to compensate for their lack of might. They have a very respected position in gnoll society, despite their weaker strength.
actors.mobs.shaman$redshaman.spell_desc=This shaman is wearing a red mask, and will use magic that temporarily _weakens your attacking power._ actors.mobs.shaman$redshaman.spell_desc=This shaman is wearing a red mask, and will use magic that temporarily _weakens your attacking power._
actors.mobs.shaman$blueshaman.spell_desc=This shaman is wearing a blue mask, and will use magic that temporarily _increases the damage you take._ actors.mobs.shaman$blueshaman.spell_desc=This shaman is wearing a blue mask, and will use magic that temporarily _increases the damage you take._
@ -614,7 +614,7 @@ actors.mobs.snake.name=sewer snake
actors.mobs.snake.desc=These oversized serpents are capable of quickly slithering around blows, making them quite hard to hit. Magical attacks or surprise attacks are capable of catching them off-guard however.\n\nYou can perform a surprise attack by attacking while out of the snake's vision. One way is to let a snake chase you through a doorway and then _strike just as it moves into the door._ actors.mobs.snake.desc=These oversized serpents are capable of quickly slithering around blows, making them quite hard to hit. Magical attacks or surprise attacks are capable of catching them off-guard however.\n\nYou can perform a surprise attack by attacking while out of the snake's vision. One way is to let a snake chase you through a doorway and then _strike just as it moves into the door._
actors.mobs.spinner.name=cave spinner actors.mobs.spinner.name=cave spinner
actors.mobs.spinner.desc=These greenish furry cave spiders try to avoid direct combat. Instead they prefer to wait in the distance while their victim struggles in their excreted cobweb, slowly dying from their poisonous bite. They are capable of shooting their webs great distances, and will try to block whatever path their prey is taking. actors.mobs.spinner.desc=These greenish furry cave spiders try to avoid direct combat. Instead they prefer to wait in the distance while their victim struggles in their excreted cobweb, slowly dying from their venomous bite. They are capable of shooting their webs great distances, and will try to block whatever path their prey is taking.
actors.mobs.statue.name=animated statue actors.mobs.statue.name=animated statue
actors.mobs.statue.def_verb=blocked actors.mobs.statue.def_verb=blocked