v2.4.0: created new methods for rolls that are for damage/blocking

This commit is contained in:
Evan Debenham
2024-04-03 13:03:48 -04:00
parent 97fc33d926
commit 2a56271091
103 changed files with 202 additions and 233 deletions

View File

@@ -153,7 +153,7 @@ public abstract class Char extends Actor {
public boolean rooted = false;
public boolean flying = false;
public int invisible = 0;
//these are relative to the hero
public enum Alignment{
ENEMY,
@@ -589,6 +589,12 @@ public abstract class Char extends Actor {
return (acuRoll * accMulti) >= defRoll;
}
//used for damage and blocking calculations, normally just calls NormalIntRange
// but may be affected by things that specifically impact combat number ranges
public static int combatRoll(int min, int max ){
return Random.NormalIntRange( min, max );
}
public int attackSkill( Char target ) {
return 0;
@@ -605,7 +611,7 @@ public abstract class Char extends Actor {
public int drRoll() {
int dr = 0;
dr += Random.NormalIntRange( 0 , Barkskin.currentLevel(this) );
dr += combatRoll( 0 , Barkskin.currentLevel(this) );
return dr;
}
@@ -735,7 +741,7 @@ public abstract class Char extends Actor {
//TODO improve this when I have proper damage source logic
if (AntiMagic.RESISTS.contains(src.getClass()) && buff(ArcaneArmor.class) != null){
dmg -= Random.NormalIntRange(0, buff(ArcaneArmor.class).level());
dmg -= combatRoll(0, buff(ArcaneArmor.class).level());
if (dmg < 0) dmg = 0;
}

View File

@@ -21,8 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import static com.watabou.utils.Random.NormalFloat;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
@@ -35,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class Bleeding extends Buff {
@@ -94,7 +93,7 @@ public class Bleeding extends Buff {
public boolean act() {
if (target.isAlive()) {
level = NormalFloat(level / 2f, level);
level = Random.NormalFloat(level / 2f, level);
int dmg = Math.round(level);
if (dmg > 0) {

View File

@@ -91,7 +91,7 @@ public class Burning extends Buff implements Hero.Doom {
if (target.isAlive() && !target.isImmune(getClass())) {
int damage = Random.NormalIntRange( 1, 3 + Dungeon.scalingDepth()/4 );
int damage = Char.combatRoll( 1, 3 + Dungeon.scalingDepth()/4 );
Buff.detach( target, Chill.class);
if (target instanceof Hero && target.buff(TimekeepersHourglass.timeStasis.class) == null) {

View File

@@ -22,13 +22,13 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class HoldFast extends Buff {
@@ -50,7 +50,7 @@ public class HoldFast extends Buff {
public int armorBonus(){
if (pos == target.pos && target instanceof Hero){
return Random.NormalIntRange(0, 2* ((Hero) target).pointsInTalent(Talent.HOLD_FAST));
return Char.combatRoll(0, 2* ((Hero) target).pointsInTalent(Talent.HOLD_FAST));
} else {
detach();
return 0;

View File

@@ -562,14 +562,14 @@ public class Hero extends Char {
int dr = super.drRoll();
if (belongings.armor() != null) {
int armDr = Random.NormalIntRange( belongings.armor().DRMin(), belongings.armor().DRMax());
int armDr = Char.combatRoll( belongings.armor().DRMin(), belongings.armor().DRMax());
if (STR() < belongings.armor().STRReq()){
armDr -= 2*(belongings.armor().STRReq() - STR());
}
if (armDr > 0) dr += armDr;
}
if (belongings.weapon() != null && !RingOfForce.fightingUnarmed(this)) {
int wepDr = Random.NormalIntRange( 0 , belongings.weapon().defenseFactor( this ) );
int wepDr = Char.combatRoll( 0 , belongings.weapon().defenseFactor( this ) );
if (STR() < ((Weapon)belongings.weapon()).STRReq()){
wepDr -= 2*(((Weapon)belongings.weapon()).STRReq() - STR());
}

View File

@@ -370,7 +370,7 @@ public class ElementalStrike extends ArmorAbility {
//*** no enchantment ***
if (ench == null) {
for (Char ch : affected){
ch.damage(Math.round(powerMulti*Random.NormalIntRange(6, 12)), ElementalStrike.this);
ch.damage(Math.round(powerMulti* Char.combatRoll(6, 12)), ElementalStrike.this);
}
//*** Kinetic ***
@@ -538,7 +538,7 @@ public class ElementalStrike extends ArmorAbility {
} else if (ench instanceof Polarized){
for (Char ch : affected){
if (Random.Float() < 0.5f*powerMulti){
ch.damage(Random.NormalIntRange(24, 36), ElementalStrike.this);
ch.damage(Char.combatRoll(24, 36), ElementalStrike.this);
}
}

View File

@@ -177,7 +177,7 @@ public class SpiritHawk extends ArmorAbility {
@Override
public int damageRoll() {
return Random.NormalIntRange(5, 10);
return Char.combatRoll(5, 10);
}
@Override

View File

@@ -267,7 +267,7 @@ public class ElementalBlast extends ArmorAbility {
//### Deal damage ###
Char mob = Actor.findChar(cell);
int damage = Math.round(Random.NormalIntRange(15, 25)
int damage = Math.round(Char.combatRoll(15, 25)
* effectMulti
* damageFactors.get(finalWandCls));
@@ -359,7 +359,7 @@ public class ElementalBlast extends ArmorAbility {
charm.ignoreHeroAllies = true;
mob.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 3);
} else {
damage = Math.round(Random.NormalIntRange(15, 25) * effectMulti);
damage = Math.round(Char.combatRoll(15, 25) * effectMulti);
mob.damage(damage, Reflection.newInstance(finalWandCls));
mob.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
}

View File

@@ -41,13 +41,13 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
import com.watabou.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.BArray;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@@ -123,7 +123,7 @@ public class WarpBeacon extends ArmorAbility {
int heroDmg = 5 * hero.pointsInTalent(Talent.TELEFRAG);
hero.damage(Math.min(heroDmg, heroHP-1), WarpBeacon.this);
int damage = Random.NormalIntRange(10*hero.pointsInTalent(Talent.TELEFRAG), 15*hero.pointsInTalent(Talent.TELEFRAG));
int damage = Char.combatRoll(10*hero.pointsInTalent(Talent.TELEFRAG), 15*hero.pointsInTalent(Talent.TELEFRAG));
existing.sprite.flash();
existing.sprite.bloodBurstA(existing.sprite.center(), damage);
existing.damage(damage, WarpBeacon.this);

View File

@@ -43,12 +43,12 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
import com.watabou.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.tweeners.Tweener;
import com.watabou.utils.BArray;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@@ -205,7 +205,7 @@ public class ShadowClone extends ArmorAbility {
@Override
public int damageRoll() {
int damage = Random.NormalIntRange(10, 20);
int damage = Char.combatRoll(10, 20);
int heroDamage = Dungeon.hero.damageRoll();
heroDamage /= Dungeon.hero.attackDelay(); //normalize hero damage based on atk speed
heroDamage = Math.round(0.08f * Dungeon.hero.pointsInTalent(Talent.SHADOW_BLADE) * heroDamage);

View File

@@ -50,12 +50,11 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
import com.watabou.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class SmokeBomb extends ArmorAbility {
@@ -179,7 +178,7 @@ public class SmokeBomb extends ArmorAbility {
public int drRoll() {
int dr = super.drRoll();
dr += Random.NormalIntRange(Dungeon.hero.pointsInTalent(Talent.BODY_REPLACEMENT),
dr += Char.combatRoll(Dungeon.hero.pointsInTalent(Talent.BODY_REPLACEMENT),
3*Dungeon.hero.pointsInTalent(Talent.BODY_REPLACEMENT));
return dr;

View File

@@ -99,7 +99,7 @@ public class HeroicLeap extends ArmorAbility {
Char mob = Actor.findChar(hero.pos + i);
if (mob != null && mob != hero && mob.alignment != Char.Alignment.ALLY) {
if (hero.hasTalent(Talent.BODY_SLAM)){
int damage = Random.NormalIntRange(hero.pointsInTalent(Talent.BODY_SLAM), 4*hero.pointsInTalent(Talent.BODY_SLAM));
int damage = Char.combatRoll(hero.pointsInTalent(Talent.BODY_SLAM), 4*hero.pointsInTalent(Talent.BODY_SLAM));
damage += Math.round(hero.drRoll()*0.25f*hero.pointsInTalent(Talent.BODY_SLAM));
damage -= mob.drRoll();
mob.damage(damage, hero);

View File

@@ -114,7 +114,7 @@ public class Shockwave extends ArmorAbility {
Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment != hero.alignment){
int scalingStr = hero.STR()-10;
int damage = Random.NormalIntRange(5 + scalingStr, 10 + 2*scalingStr);
int damage = Char.combatRoll(5 + scalingStr, 10 + 2*scalingStr);
damage = Math.round(damage * (1f + 0.2f*hero.pointsInTalent(Talent.SHOCK_FORCE)));
damage -= ch.drRoll();

View File

@@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class ArmoredStatue extends Statue {
@@ -75,7 +74,7 @@ public class ArmoredStatue extends Statue {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange( armor.DRMin(), armor.DRMax());
return super.drRoll() + Char.combatRoll( armor.DRMin(), armor.DRMax());
}
//used in some glyph calculations

View File

@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.sprites.BatSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.watabou.utils.Random;
public class Bat extends Mob {
@@ -50,7 +49,7 @@ public class Bat extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 5, 18 );
return Char.combatRoll( 5, 18 );
}
@Override
@@ -60,7 +59,7 @@ public class Bat extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
@Override

View File

@@ -111,7 +111,7 @@ public class Bee extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( HT / 10, HT / 4 );
return Char.combatRoll( HT / 10, HT / 4 );
}
@Override

View File

@@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.BruteSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Brute extends Mob {
@@ -58,8 +57,8 @@ public class Brute extends Mob {
@Override
public int damageRoll() {
return buff(BruteRage.class) != null ?
Random.NormalIntRange( 15, 40 ) :
Random.NormalIntRange( 5, 25 );
Char.combatRoll( 15, 40 ) :
Char.combatRoll( 5, 25 );
}
@Override
@@ -69,7 +68,7 @@ public class Brute extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 8);
return super.drRoll() + Char.combatRoll(0, 8);
}
@Override

View File

@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CrabSprite;
import com.watabou.utils.Random;
public class Crab extends Mob {
@@ -44,7 +43,7 @@ public class Crab extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 7 );
return Char.combatRoll( 1, 7 );
}
@Override
@@ -54,6 +53,6 @@ public class Crab extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
}

View File

@@ -84,7 +84,7 @@ public class CrystalGuardian extends Mob{
@Override
public int damageRoll() {
return Random.NormalIntRange( 10, 16 );
return Char.combatRoll( 10, 16 );
}
@Override
@@ -106,7 +106,7 @@ public class CrystalGuardian extends Mob{
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 10);
return super.drRoll() + Char.combatRoll(0, 10);
}
@Override

View File

@@ -126,7 +126,7 @@ public class CrystalSpire extends Mob {
Char ch = Actor.findChar(i);
if (ch != null && !(ch instanceof CrystalWisp || ch instanceof CrystalSpire)){
int dmg = Random.NormalIntRange(6, 15);
int dmg = Char.combatRoll(6, 15);
//guardians are hit harder by the attack
if (ch instanceof CrystalGuardian) {

View File

@@ -75,7 +75,7 @@ public class CrystalWisp extends Mob{
@Override
public int damageRoll() {
return Random.NormalIntRange( 5, 10 );
return Char.combatRoll( 5, 10 );
}
@Override
@@ -85,7 +85,7 @@ public class CrystalWisp extends Mob{
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
@Override
@@ -123,7 +123,7 @@ public class CrystalWisp extends Mob{
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
int dmg = Random.NormalIntRange( 5, 10 );
int dmg = Char.combatRoll( 5, 10 );
enemy.damage( dmg, new LightBeam() );
if (!enemy.isAlive() && enemy == Dungeon.hero) {

View File

@@ -35,7 +35,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.DM100Sprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
public class DM100 extends Mob implements Callback {
@@ -59,7 +58,7 @@ public class DM100 extends Mob implements Callback {
@Override
public int damageRoll() {
return Random.NormalIntRange( 2, 8 );
return Char.combatRoll( 2, 8 );
}
@Override
@@ -69,7 +68,7 @@ public class DM100 extends Mob implements Callback {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
@Override
@@ -95,7 +94,7 @@ public class DM100 extends Mob implements Callback {
Invisibility.dispel(this);
if (hit( this, enemy, true )) {
int dmg = Random.NormalIntRange(3, 10);
int dmg = Char.combatRoll(3, 10);
dmg = Math.round(dmg * AscensionChallenge.statModifier(this));
enemy.damage( dmg, new LightningBolt() );

View File

@@ -57,7 +57,7 @@ public class DM200 extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 10, 25 );
return Char.combatRoll( 10, 25 );
}
@Override
@@ -67,7 +67,7 @@ public class DM200 extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 8);
return super.drRoll() + Char.combatRoll(0, 8);
}
@Override

View File

@@ -45,7 +45,7 @@ public class DM201 extends DM200 {
@Override
public int damageRoll() {
return Random.NormalIntRange( 15, 25 );
return Char.combatRoll( 15, 25 );
}
private boolean threatened = false;

View File

@@ -91,7 +91,7 @@ public class DM300 extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 15, 25 );
return Char.combatRoll( 15, 25 );
}
@Override
@@ -101,7 +101,7 @@ public class DM300 extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 10);
return super.drRoll() + Char.combatRoll(0, 10);
}
public int pylonsActivated = 0;

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Dread;
@@ -67,7 +68,7 @@ public class DemonSpawner extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 12);
return super.drRoll() + Char.combatRoll(0, 12);
}
@Override

View File

@@ -89,7 +89,7 @@ public class DwarfKing extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 15, 25 );
return Char.combatRoll( 15, 25 );
}
@Override
@@ -99,7 +99,7 @@ public class DwarfKing extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 10);
return super.drRoll() + Char.combatRoll(0, 10);
}
private int phase = 1;
@@ -686,7 +686,7 @@ public class DwarfKing extends Mob {
}
} else {
Char ch = Actor.findChar(pos);
ch.damage(Random.NormalIntRange(20, 40), this);
ch.damage(Char.combatRoll(20, 40), this);
if (((DwarfKing)target).phase == 2){
if (Dungeon.isChallenged(Challenges.STRONGER_BOSSES)){
target.damage(target.HT/18, new KingDamager());

View File

@@ -81,10 +81,10 @@ public abstract class Elemental extends Mob {
@Override
public int damageRoll() {
if (!summonedALly) {
return Random.NormalIntRange(20, 25);
return Char.combatRoll(20, 25);
} else {
int regionScale = Math.max(2, (1 + Dungeon.scalingDepth()/5));
return Random.NormalIntRange(5*regionScale, 5 + 5*regionScale);
return Char.combatRoll(5*regionScale, 5 + 5*regionScale);
}
}
@@ -108,10 +108,10 @@ public abstract class Elemental extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
protected int rangedCooldown = Random.NormalIntRange( 3, 5 );
protected int rangedCooldown = Char.combatRoll( 3, 5 );
@Override
protected boolean act() {
@@ -183,7 +183,7 @@ public abstract class Elemental extends Mob {
@Override
public boolean add( Buff buff ) {
if (harmfulBuffs.contains( buff.getClass() )) {
damage( Random.NormalIntRange( HT/2, HT * 3/5 ), buff );
damage( Char.combatRoll( HT/2, HT * 3/5 ), buff );
return false;
} else {
return super.add( buff );
@@ -384,7 +384,7 @@ public abstract class Elemental extends Mob {
@Override
public int damageRoll() {
if (!summonedALly) {
return Random.NormalIntRange(10, 12);
return combatRoll(10, 12);
} else {
return super.damageRoll();
}

View File

@@ -69,7 +69,7 @@ public class Eye extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange(20, 30);
return Char.combatRoll(20, 30);
}
@Override
@@ -79,7 +79,7 @@ public class Eye extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 10);
return super.drRoll() + Char.combatRoll(0, 10);
}
private Ballistica beam;
@@ -184,7 +184,7 @@ public class Eye extends Mob {
}
if (hit( this, ch, true )) {
int dmg = Random.NormalIntRange( 30, 50 );
int dmg = Char.combatRoll( 30, 50 );
dmg = Math.round(dmg * AscensionChallenge.statModifier(this));
ch.damage( dmg, new DeathGaze() );

View File

@@ -57,7 +57,7 @@ public class FetidRat extends Rat {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 2);
return super.drRoll() + Char.combatRoll(0, 2);
}
@Override

View File

@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.FungalSentrySprite;
import com.watabou.utils.Random;
public class FungalSentry extends Mob {
@@ -68,7 +67,7 @@ public class FungalSentry extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange(5, 10);
return Char.combatRoll(5, 10);
}
@Override

View File

@@ -65,7 +65,7 @@ public class Ghoul extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 16, 22 );
return Char.combatRoll( 16, 22 );
}
@Override
@@ -75,7 +75,7 @@ public class Ghoul extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
@Override

View File

@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollSprite;
import com.watabou.utils.Random;
public class Gnoll extends Mob {
@@ -43,7 +42,7 @@ public class Gnoll extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 6 );
return Char.combatRoll( 1, 6 );
}
@Override
@@ -53,6 +52,6 @@ public class Gnoll extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 2);
return super.drRoll() + Char.combatRoll(0, 2);
}
}

View File

@@ -137,7 +137,7 @@ public class GnollGeomancer extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 3, 6 );
return Char.combatRoll( 3, 6 );
}
@Override
@@ -147,7 +147,7 @@ public class GnollGeomancer extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 6);
return super.drRoll() + Char.combatRoll(0, 6);
}
@Override
@@ -692,7 +692,7 @@ public class GnollGeomancer extends Mob {
}
if (ch != null && !(ch instanceof GnollGeomancer)){
ch.damage(Random.NormalIntRange(6, 12), new GnollGeomancer.Boulder());
ch.damage(Char.combatRoll(6, 12), new GnollGeomancer.Boulder());
if (ch.isAlive()){
Buff.prolong( ch, Paralysis.class, ch instanceof GnollGuard ? 10 : 3 );
@@ -795,7 +795,7 @@ public class GnollGeomancer extends Mob {
@Override
public void affectChar(Char ch) {
ch.damage(Random.NormalIntRange(6, 12), this);
ch.damage(Char.combatRoll(6, 12), this);
if (ch.isAlive()) {
Buff.prolong(ch, Paralysis.class, ch instanceof GnollGuard ? 10 : 3);
} else if (ch == Dungeon.hero){

View File

@@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollGuardSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class GnollGuard extends Mob {
@@ -82,9 +81,9 @@ public class GnollGuard extends Mob {
@Override
public int damageRoll() {
if (enemy != null && !Dungeon.level.adjacent(pos, enemy.pos)){
return Random.NormalIntRange( 16, 22 );
return Char.combatRoll( 16, 22 );
} else {
return Random.NormalIntRange( 6, 12 );
return Char.combatRoll( 6, 12 );
}
}
@@ -104,7 +103,7 @@ public class GnollGuard extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 6);
return super.drRoll() + Char.combatRoll(0, 6);
}
@Override

View File

@@ -96,7 +96,7 @@ public class GnollSapper extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 6 );
return Char.combatRoll( 1, 6 );
}
@Override
@@ -112,7 +112,7 @@ public class GnollSapper extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 6);
return super.drRoll() + Char.combatRoll(0, 6);
}
@Override

View File

@@ -60,7 +60,7 @@ public class Golem extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 25, 30 );
return Char.combatRoll( 25, 30 );
}
@Override
@@ -70,7 +70,7 @@ public class Golem extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 12);
return super.drRoll() + Char.combatRoll(0, 12);
}
@Override

View File

@@ -74,9 +74,9 @@ public class Goo extends Mob {
Statistics.qualifiedForBossChallengeBadge = false;
Statistics.bossScores[0] -= 100;
}
return Random.NormalIntRange( min*3, max*3 );
return Char.combatRoll( min*3, max*3 );
} else {
return Random.NormalIntRange( min, max );
return Char.combatRoll( min, max );
}
}
@@ -95,7 +95,7 @@ public class Goo extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 2);
return super.drRoll() + Char.combatRoll(0, 2);
}
@Override

View File

@@ -38,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.GuardSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
public class Guard extends Mob {
@@ -64,7 +63,7 @@ public class Guard extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange(4, 12);
return Char.combatRoll(4, 12);
}
private boolean chain(int target){
@@ -137,7 +136,7 @@ public class Guard extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 7);
return super.drRoll() + Char.combatRoll(0, 7);
}
@Override

View File

@@ -213,15 +213,15 @@ public class Mimic extends Mob {
@Override
public int damageRoll() {
if (alignment == Alignment.NEUTRAL){
return Random.NormalIntRange( 2 + 2*level, 2 + 2*level);
return Char.combatRoll( 2 + 2*level, 2 + 2*level);
} else {
return Random.NormalIntRange( 1 + level, 2 + 2*level);
return Char.combatRoll( 1 + level, 2 + 2*level);
}
}
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 1 + level/2);
return super.drRoll() + Char.combatRoll(0, 1 + level/2);
}
@Override

View File

@@ -53,7 +53,7 @@ public class Monk extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 12, 25 );
return Char.combatRoll( 12, 25 );
}
@Override
@@ -68,7 +68,7 @@ public class Monk extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 2);
return super.drRoll() + Char.combatRoll(0, 2);
}
@Override

View File

@@ -44,7 +44,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.BArray;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class Necromancer extends Mob {
@@ -84,7 +83,7 @@ public class Necromancer extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
@Override
@@ -216,7 +215,7 @@ public class Necromancer extends Mob {
Char blocker = Actor.findChar(summoningPos);
if (blocker.alignment != alignment){
blocker.damage( Random.NormalIntRange(2, 10), new SummoningBlockDamage() );
blocker.damage( Char.combatRoll(2, 10), new SummoningBlockDamage() );
if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(this);

View File

@@ -76,7 +76,7 @@ public class Piranha extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( Dungeon.depth, 4 + Dungeon.depth * 2 );
return Char.combatRoll( Dungeon.depth, 4 + Dungeon.depth * 2 );
}
@Override
@@ -86,7 +86,7 @@ public class Piranha extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, Dungeon.depth);
return super.drRoll() + Char.combatRoll(0, Dungeon.depth);
}
@Override

View File

@@ -140,7 +140,7 @@ public class Pylon extends Mob {
private void shockChar( Char ch ){
if (ch != null && !(ch instanceof DM300)){
ch.sprite.flash();
ch.damage(Random.NormalIntRange(10, 20), new Electricity());
ch.damage(Char.combatRoll(10, 20), new Electricity());
if (ch == Dungeon.hero) {
Statistics.qualifiedForBossChallengeBadge = false;

View File

@@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Rat extends Mob {
@@ -50,7 +49,7 @@ public class Rat extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 4 );
return Char.combatRoll( 1, 4 );
}
@Override
@@ -60,7 +59,7 @@ public class Rat extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 1);
return super.drRoll() + Char.combatRoll(0, 1);
}
private static final String RAT_ALLY = "rat_ally";

View File

@@ -69,7 +69,7 @@ public class RipperDemon extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 15, 25 );
return Char.combatRoll( 15, 25 );
}
@Override
@@ -84,7 +84,7 @@ public class RipperDemon extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
private static final String LAST_ENEMY_POS = "last_enemy_pos";

View File

@@ -37,7 +37,6 @@ import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RotHeartSprite;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class RotHeart extends Mob {
@@ -131,7 +130,7 @@ public class RotHeart extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
{

View File

@@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RotLasherSprite;
import com.watabou.utils.Random;
public class RotLasher extends Mob {
@@ -96,7 +95,7 @@ public class RotLasher extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange(10, 20);
return Char.combatRoll(10, 20);
}
@Override
@@ -106,7 +105,7 @@ public class RotLasher extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 8);
return super.drRoll() + Char.combatRoll(0, 8);
}
{

View File

@@ -56,7 +56,7 @@ public class Scorpio extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 30, 40 );
return Char.combatRoll( 30, 40 );
}
@Override
@@ -66,7 +66,7 @@ public class Scorpio extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 16);
return super.drRoll() + Char.combatRoll(0, 16);
}
@Override

View File

@@ -21,9 +21,9 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SeniorSprite;
import com.watabou.utils.Random;
public class Senior extends Monk {
@@ -44,7 +44,7 @@ public class Senior extends Monk {
@Override
public int damageRoll() {
return Random.NormalIntRange( 16, 25 );
return Char.combatRoll( 16, 25 );
}
}

View File

@@ -56,7 +56,7 @@ public abstract class Shaman extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 5, 10 );
return Char.combatRoll( 5, 10 );
}
@Override
@@ -66,7 +66,7 @@ public abstract class Shaman extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 6);
return super.drRoll() + Char.combatRoll(0, 6);
}
@Override
@@ -122,7 +122,7 @@ public abstract class Shaman extends Mob {
if (enemy == Dungeon.hero) Sample.INSTANCE.play( Assets.Sounds.DEBUFF );
}
int dmg = Random.NormalIntRange( 6, 15 );
int dmg = Char.combatRoll( 6, 15 );
dmg = Math.round(dmg * AscensionChallenge.statModifier(this));
enemy.damage( dmg, new EarthenBolt() );

View File

@@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.SkeletonSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class Skeleton extends Mob {
@@ -55,7 +54,7 @@ public class Skeleton extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 2, 10 );
return Char.combatRoll( 2, 10 );
}
@Override
@@ -69,7 +68,7 @@ public class Skeleton extends Mob {
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char ch = findChar( pos + PathFinder.NEIGHBOURS8[i] );
if (ch != null && ch.isAlive()) {
int damage = Math.round(Random.NormalIntRange(6, 12));
int damage = Math.round(Char.combatRoll(6, 12));
damage = Math.round( damage * AscensionChallenge.statModifier(this));
//armor is 2x effective against bone explosion
damage = Math.max( 0, damage - (ch.drRoll() + ch.drRoll()) );
@@ -110,7 +109,7 @@ public class Skeleton extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
}

View File

@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SlimeSprite;
import com.watabou.utils.Random;
public class Slime extends Mob {
@@ -46,7 +45,7 @@ public class Slime extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 2, 5 );
return Char.combatRoll( 2, 5 );
}
@Override

View File

@@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SnakeSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Random;
public class Snake extends Mob {
@@ -49,7 +48,7 @@ public class Snake extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 4 );
return Char.combatRoll( 1, 4 );
}
@Override

View File

@@ -136,7 +136,7 @@ public class SpectralNecromancer extends Necromancer {
Char blocker = Actor.findChar(summoningPos);
if (blocker.alignment != alignment){
blocker.damage( Random.NormalIntRange(2, 10), new SummoningBlockDamage() );
blocker.damage( Char.combatRoll(2, 10), new SummoningBlockDamage() );
if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(this);

View File

@@ -58,7 +58,7 @@ public class Spinner extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange(10, 20);
return Char.combatRoll(10, 20);
}
@Override
@@ -68,7 +68,7 @@ public class Spinner extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 6);
return super.drRoll() + Char.combatRoll(0, 6);
}
private int webCoolDown = 0;

View File

@@ -114,7 +114,7 @@ public class Statue extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, Dungeon.depth + weapon.defenseFactor(this));
return super.drRoll() + Char.combatRoll(0, Dungeon.depth + weapon.defenseFactor(this));
}
@Override

View File

@@ -70,7 +70,7 @@ public class Succubus extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 25, 30 );
return Char.combatRoll( 25, 30 );
}
@Override
@@ -166,7 +166,7 @@ public class Succubus extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 10);
return super.drRoll() + Char.combatRoll(0, 10);
}
@Override

View File

@@ -77,7 +77,7 @@ public class Swarm extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 4 );
return Char.combatRoll( 1, 4 );
}
@Override

View File

@@ -101,7 +101,7 @@ public class Tengu extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 6, 12 );
return Char.combatRoll( 6, 12 );
}
@Override
@@ -115,7 +115,7 @@ public class Tengu extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 5);
return super.drRoll() + Char.combatRoll(0, 5);
}
boolean loading = false;
@@ -626,7 +626,7 @@ public class Tengu extends Mob {
if (PathFinder.distance[cell] < Integer.MAX_VALUE) {
Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof Tengu)) {
int dmg = Random.NormalIntRange(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth() * 2);
int dmg = Char.combatRoll(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth() * 2);
dmg -= ch.drRoll();
if (dmg > 0) {

View File

@@ -80,7 +80,7 @@ public class Thief extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 10 );
return Char.combatRoll( 1, 10 );
}
@Override
@@ -119,7 +119,7 @@ public class Thief extends Mob {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 3);
return super.drRoll() + Char.combatRoll(0, 3);
}
@Override

View File

@@ -44,7 +44,7 @@ public class TormentedSpirit extends Wraith {
//50% more damage scaling than regular wraiths
@Override
public int damageRoll() {
return Random.NormalIntRange( 1 + Math.round(1.5f*level)/2, 2 + Math.round(1.5f*level) );
return Char.combatRoll( 1 + Math.round(1.5f*level)/2, 2 + Math.round(1.5f*level) );
}
//50% more accuracy (and by extension evasion) scaling than regular wraiths

View File

@@ -62,7 +62,7 @@ public class Warlock extends Mob implements Callback {
@Override
public int damageRoll() {
return Random.NormalIntRange( 12, 18 );
return Char.combatRoll( 12, 18 );
}
@Override
@@ -72,7 +72,7 @@ public class Warlock extends Mob implements Callback {
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 8);
return super.drRoll() + Char.combatRoll(0, 8);
}
@Override
@@ -115,7 +115,7 @@ public class Warlock extends Mob implements Callback {
Sample.INSTANCE.play( Assets.Sounds.DEBUFF );
}
int dmg = Random.NormalIntRange( 12, 18 );
int dmg = Char.combatRoll( 12, 18 );
dmg = Math.round(dmg * AscensionChallenge.statModifier(this));
enemy.damage( dmg, new DarkBolt() );

View File

@@ -72,7 +72,7 @@ public class Wraith extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 1 + level/2, 2 + level );
return Char.combatRoll( 1 + level/2, 2 + level );
}
@Override

View File

@@ -245,9 +245,9 @@ public class YogDzewa extends Mob {
if (hit( this, ch, true )) {
if (Dungeon.isChallenged(Challenges.STRONGER_BOSSES)) {
ch.damage(Random.NormalIntRange(30, 50), new Eye.DeathGaze());
ch.damage(Char.combatRoll(30, 50), new Eye.DeathGaze());
} else {
ch.damage(Random.NormalIntRange(20, 30), new Eye.DeathGaze());
ch.damage(Char.combatRoll(20, 30), new Eye.DeathGaze());
}
if (Dungeon.level.heroFOV[pos]) {
ch.sprite.flash();
@@ -663,12 +663,12 @@ public class YogDzewa extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 15, 25 );
return Char.combatRoll( 15, 25 );
}
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 4);
return super.drRoll() + Char.combatRoll(0, 4);
}
}

View File

@@ -172,12 +172,12 @@ public abstract class YogFist extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 18, 36 );
return Char.combatRoll( 18, 36 );
}
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 15);
return super.drRoll() + Char.combatRoll(0, 15);
}
{
@@ -449,7 +449,7 @@ public abstract class YogFist extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( 22, 44 );
return Char.combatRoll( 22, 44 );
}
@Override
@@ -499,7 +499,7 @@ public abstract class YogFist extends Mob {
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
enemy.damage( Random.NormalIntRange(10, 20), new LightBeam() );
enemy.damage( Char.combatRoll(10, 20), new LightBeam() );
Buff.prolong( enemy, Blindness.class, Blindness.DURATION/2f );
if (!enemy.isAlive() && enemy == Dungeon.hero) {
@@ -565,7 +565,7 @@ public abstract class YogFist extends Mob {
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
enemy.damage( Random.NormalIntRange(10, 20), new DarkBolt() );
enemy.damage( Char.combatRoll(10, 20), new DarkBolt() );
Light l = enemy.buff(Light.class);
if (l != null){

View File

@@ -40,7 +40,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class MirrorImage extends NPC {
@@ -151,7 +150,7 @@ public class MirrorImage extends NPC {
public int drRoll() {
int dr = super.drRoll();
if (hero != null && hero.belongings.weapon() != null){
return dr + Random.NormalIntRange(0, hero.belongings.weapon().defenseFactor(this)/2);
return dr + Char.combatRoll(0, hero.belongings.weapon().defenseFactor(this)/2);
} else {
return dr;
}

View File

@@ -43,7 +43,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.PrismaticSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class PrismaticImage extends NPC {
@@ -152,9 +151,9 @@ public class PrismaticImage extends NPC {
@Override
public int damageRoll() {
if (hero != null) {
return Random.NormalIntRange( 2 + hero.lvl/4, 4 + hero.lvl/2 );
return Char.combatRoll( 2 + hero.lvl/4, 4 + hero.lvl/2 );
} else {
return Random.NormalIntRange( 2, 4 );
return Char.combatRoll( 2, 4 );
}
}

View File

@@ -34,12 +34,11 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
import com.watabou.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
abstract public class KindOfWeapon extends EquipableItem {
@@ -225,7 +224,7 @@ abstract public class KindOfWeapon extends EquipableItem {
abstract public int max(int lvl);
public int damageRoll( Char owner ) {
return Random.NormalIntRange( min(), max() );
return Char.combatRoll( min(), max() );
}
public float accuracyFactor( Char owner, Char target ) {

View File

@@ -61,7 +61,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Holy
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisintegrationTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrimTrap;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Random;
import java.util.HashSet;
@@ -129,7 +128,7 @@ public class AntiMagic extends Armor.Glyph {
}
public static int drRoll( Char ch, int level ){
return Random.NormalIntRange(
return Char.combatRoll(
Math.round(level * genericProcChanceMultiplier(ch)),
Math.round((3 + (level*1.5f)) * genericProcChanceMultiplier(ch)));
}

View File

@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Random;
public class CapeOfThorns extends Artifact {
@@ -100,7 +99,7 @@ public class CapeOfThorns extends Artifact {
}
if (cooldown != 0){
int deflected = Random.NormalIntRange(0, damage);
int deflected = Char.combatRoll(0, damage);
damage -= deflected;
if (attacker != null && Dungeon.level.adjacent(attacker.pos, defender.pos)) {

View File

@@ -624,7 +624,7 @@ public class DriedRose extends Artifact {
if (rose != null && rose.weapon != null){
dmg += rose.weapon.damageRoll(this);
} else {
dmg += Random.NormalIntRange(0, 5);
dmg += Char.combatRoll(0, 5);
}
return dmg;
@@ -710,10 +710,10 @@ public class DriedRose extends Artifact {
public int drRoll() {
int dr = super.drRoll();
if (rose != null && rose.armor != null){
dr += Random.NormalIntRange( rose.armor.DRMin(), rose.armor.DRMax());
dr += Char.combatRoll( rose.armor.DRMin(), rose.armor.DRMax());
}
if (rose != null && rose.weapon != null){
dr += Random.NormalIntRange( 0, rose.weapon.defenseFactor( this ));
dr += Char.combatRoll( 0, rose.weapon.defenseFactor( this ));
}
return dr;
}

View File

@@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -81,7 +80,7 @@ public class ArcaneBomb extends Bomb {
for (Char ch : affected){
// 100%/83%/67% bomb damage based on distance, but pierces armor.
int damage = Math.round(Random.NormalIntRange( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ));
int damage = Math.round(Char.combatRoll( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ));
float multiplier = 1f - (.16667f*Dungeon.level.distance(cell, ch.pos));
ch.damage(Math.round(damage*multiplier), this);
if (ch == Dungeon.hero && !ch.isAlive()){

View File

@@ -183,7 +183,7 @@ public class Bomb extends Item {
continue;
}
int dmg = Random.NormalIntRange(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth()*2);
int dmg = Char.combatRoll(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth()*2);
//those not at the center of the blast take less damage
if (ch.pos != cell){

View File

@@ -29,10 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -68,7 +67,7 @@ public class HolyBomb extends Bomb {
ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );
//bomb deals an additional 50% damage to unholy enemies in a 5x5 range
int damage = Math.round(Random.NormalIntRange( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ) * 0.5f);
int damage = Math.round(Char.combatRoll( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ) * 0.5f);
ch.damage(damage, new HolyDamage());
}
}

View File

@@ -33,10 +33,9 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -71,7 +70,7 @@ public class ShockBomb extends Bomb {
int power = 16 - 4*Dungeon.level.distance(ch.pos, cell);
if (power > 0){
//32% to 8% regular bomb damage
int damage = Math.round(Random.NormalIntRange(5 + Dungeon.scalingDepth(), 10 + 2*Dungeon.scalingDepth()) * (power/50f));
int damage = Math.round(Char.combatRoll(5 + Dungeon.scalingDepth(), 10 + 2*Dungeon.scalingDepth()) * (power/50f));
ch.damage(damage, this);
if (ch.isAlive()) Buff.prolong(ch, Paralysis.class, power);
arcs.add(new Lightning.Arc(DungeonTilemap.tileCenterToWorld(cell), ch.sprite.center()));

View File

@@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -68,7 +67,7 @@ public class ShrapnelBomb extends Bomb {
for (Char ch : affected){
//regular bomb damage, which falls off at a rate of 5% per tile of distance
int damage = Math.round(Random.NormalIntRange( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ));
int damage = Math.round(Char.combatRoll( Dungeon.scalingDepth()+5, 10 + Dungeon.scalingDepth() * 2 ));
damage = Math.round(damage * (1f - .05f*Dungeon.level.distance(cell, ch.pos)));
damage -= ch.drRoll();
ch.damage(damage, this);

View File

@@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Image;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -82,10 +81,10 @@ public class RingOfForce extends Ring {
&& hero.buff(MonkEnergy.MonkAbility.UnarmedAbilityTracker.class) == null) {
int level = getBuffedBonus(hero, Force.class);
float tier = tier(hero.STR());
return Random.NormalIntRange(min(level, tier), max(level, tier));
return Char.combatRoll(min(level, tier), max(level, tier));
} else {
//attack without any ring of force influence
return Random.NormalIntRange(1, Math.max(hero.STR()-8, 1));
return Char.combatRoll(1, Math.max(hero.STR()-8, 1));
}
}

View File

@@ -23,10 +23,10 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.WandEmpower;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
//for wands that directly damage a target
//wands with AOE effects count here (e.g. fireblast), but wands with indrect damage do not (e.g. venom, transfusion)
@@ -49,7 +49,7 @@ public abstract class DamageWand extends Wand{
}
public int damageRoll(int lvl){
int dmg = Random.NormalIntRange(min(lvl), max(lvl));
int dmg = Char.combatRoll(min(lvl), max(lvl));
WandEmpower emp = Dungeon.hero.buff(WandEmpower.class);
if (emp != null){
dmg += emp.dmgBoost;

View File

@@ -158,7 +158,7 @@ public class WandOfBlastWave extends DamageWand {
int oldPos = ch.pos;
ch.pos = newPos;
if (finalCollided && ch.isActive()) {
ch.damage(Random.NormalIntRange(finalDist, 2*finalDist), new Knockback());
ch.damage(Char.combatRoll(finalDist, 2*finalDist), new Knockback());
if (ch.isActive()) {
Paralysis.prolong(ch, Paralysis.class, 1 + finalDist/2f);
} else if (ch == Dungeon.hero){

View File

@@ -353,16 +353,16 @@ public class WandOfLivingEarth extends DamageWand {
@Override
public int damageRoll() {
return Random.NormalIntRange(2, 4 + Dungeon.scalingDepth()/2);
return Char.combatRoll(2, 4 + Dungeon.scalingDepth()/2);
}
@Override
public int drRoll() {
int dr = super.drRoll();
if (Dungeon.isChallenged(Challenges.NO_ARMOR)){
return dr + Random.NormalIntRange(wandLevel, 2 + wandLevel);
return dr + Char.combatRoll(wandLevel, 2 + wandLevel);
} else {
return dr + Random.NormalIntRange(wandLevel, 3 + 3 * wandLevel);
return dr + Char.combatRoll(wandLevel, 3 + 3 * wandLevel);
}
}

View File

@@ -124,7 +124,7 @@ public class WandOfTransfusion extends Wand {
//harms the undead
} else {
ch.damage(Random.NormalIntRange(3 + buffedLvl(), 6+2*buffedLvl()), this);
ch.damage(Char.combatRoll(3 + buffedLvl(), 6+2*buffedLvl()), this);
ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + buffedLvl());
Sample.INSTANCE.play(Assets.Sounds.BURNING);
}

View File

@@ -304,7 +304,7 @@ public class WandOfWarding extends Wand {
public int drRoll() {
int dr = super.drRoll();
if (tier > 3){
return dr + Math.round(Random.NormalIntRange(0, 3 + Dungeon.scalingDepth()/2) / (7f - tier));
return dr + Math.round(Char.combatRoll(0, 3 + Dungeon.scalingDepth()/2) / (7f - tier));
} else {
return dr;
}
@@ -331,7 +331,7 @@ public class WandOfWarding extends Wand {
spend( 1f );
//always hits
int dmg = Random.NormalIntRange( 2 + wandLevel, 8 + 4*wandLevel );
int dmg = Char.combatRoll( 2 + wandLevel, 8 + 4*wandLevel );
Char enemy = this.enemy;
enemy.damage( dmg, this );
if (enemy.isAlive()){

View File

@@ -214,7 +214,7 @@ public class SpiritBow extends Weapon {
if (owner instanceof Hero) {
int exStr = ((Hero)owner).STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange( 0, exStr );
damage += Char.combatRoll( 0, exStr );
}
}

View File

@@ -53,7 +53,7 @@ public class Blazing extends Weapon.Enchantment {
}
if (powerMulti > 0){
int burnDamage = Random.NormalIntRange( 1, 3 + Dungeon.scalingDepth()/4 );
int burnDamage = Char.combatRoll( 1, 3 + Dungeon.scalingDepth()/4 );
burnDamage = Math.round(burnDamage * 0.67f * powerMulti);
if (burnDamage > 0) {
defender.damage(burnDamage, this);

View File

@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class AssassinsBlade extends MeleeWeapon {
@@ -53,12 +52,12 @@ public class AssassinsBlade extends MeleeWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 50% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = augment.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Char.combatRoll(
min() + Math.round(diff*0.50f),
max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
damage += Char.combatRoll(0, exStr);
}
return damage;
}

View File

@@ -39,7 +39,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class Dagger extends MeleeWeapon {
@@ -67,12 +66,12 @@ public class Dagger extends MeleeWeapon {
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();
int damage = augment.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Char.combatRoll(
min() + Math.round(diff*0.75f),
max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
damage += Char.combatRoll(0, exStr);
}
return damage;
}

View File

@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class Dirk extends MeleeWeapon {
@@ -53,12 +52,12 @@ public class Dirk extends MeleeWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 67% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = augment.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Char.combatRoll(
min() + Math.round(diff*0.67f),
max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
damage += Char.combatRoll(0, exStr);
}
return damage;
}

View File

@@ -53,7 +53,6 @@ import com.watabou.noosa.Image;
import com.watabou.noosa.Visual;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -348,7 +347,7 @@ public class MeleeWeapon extends Weapon {
if (owner instanceof Hero) {
int exStr = ((Hero)owner).STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange( 0, exStr );
damage += Char.combatRoll( 0, exStr );
}
}

View File

@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class Kunai extends MissileWeapon {
@@ -55,12 +54,12 @@ public class Kunai extends MissileWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 60% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = augment.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Char.combatRoll(
min() + Math.round(diff*0.6f),
max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
damage += Char.combatRoll(0, exStr);
}
return damage;
}

View File

@@ -376,7 +376,7 @@ abstract public class MissileWeapon extends Weapon {
if (owner instanceof Hero) {
int exStr = ((Hero)owner).STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange( 0, exStr );
damage += Char.combatRoll( 0, exStr );
}
if (owner.buff(Momentum.class) != null && owner.buff(Momentum.class).freerunning()) {
damage = Math.round(damage * (1f + 0.15f * ((Hero) owner).pointsInTalent(Talent.PROJECTILE_MOMENTUM)));

View File

@@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class ThrowingKnife extends MissileWeapon {
@@ -55,12 +54,12 @@ public class ThrowingKnife extends MissileWeapon {
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();
int damage = augment.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Char.combatRoll(
min() + Math.round(diff*0.75f),
max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
damage += Char.combatRoll(0, exStr);
}
return damage;
}

View File

@@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
public class HolyDart extends TippedDart {
@@ -53,7 +52,7 @@ public class HolyDart extends TippedDart {
if (Char.hasProp(defender, Char.Property.UNDEAD) || Char.hasProp(defender, Char.Property.DEMONIC)){
defender.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+buffedLvl() );
Sample.INSTANCE.play(Assets.Sounds.BURNING);
defender.damage(Random.NormalIntRange(10 + Dungeon.scalingDepth()/3, 20 + Dungeon.scalingDepth()/3), this);
defender.damage(Char.combatRoll(10 + Dungeon.scalingDepth()/3, 20 + Dungeon.scalingDepth()/3), this);
//also do not bless enemies if processing charged shot
} else if (!processingChargedShot){
Buff.affect(defender, Bless.class, Math.round(Bless.DURATION));

View File

@@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -45,7 +44,7 @@ public class ShockingDart extends TippedDart {
//when processing charged shot, only shock enemies
if (!processingChargedShot || attacker.alignment != defender.alignment) {
defender.damage(Random.NormalIntRange(5 + Dungeon.scalingDepth() / 4, 10 + Dungeon.scalingDepth() / 4), new Electricity());
defender.damage(Char.combatRoll(5 + Dungeon.scalingDepth() / 4, 10 + Dungeon.scalingDepth() / 4), new Electricity());
CharSprite s = defender.sprite;
if (s != null && s.parent != null) {

View File

@@ -827,7 +827,7 @@ public class CavesBossLevel extends Level {
Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof DM300) && !ch.flying) {
Sample.INSTANCE.play( Assets.Sounds.LIGHTNING );
ch.damage( Random.NormalIntRange(6, 12), new Electricity());
ch.damage( Char.combatRoll(6, 12), new Electricity());
ch.sprite.flash();
if (ch == Dungeon.hero){

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
@@ -46,7 +47,6 @@ import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
public class Chasm implements Hero.Doom {
@@ -146,7 +146,7 @@ public class Chasm implements Hero.Doom {
//The lower the hero's HP, the more bleed and the less upfront damage.
//Hero has a 50% chance to bleed out at 66% HP, and begins to risk instant-death at 25%
Buff.affect( hero, Bleeding.class).set( Math.round(hero.HT / (6f + (6f*(hero.HP/(float)hero.HT)))), Chasm.class);
hero.damage( Math.max( hero.HP / 2, Random.NormalIntRange( hero.HP / 2, hero.HT / 4 )), new Chasm() );
hero.damage( Math.max( hero.HP / 2, Char.combatRoll( hero.HP / 2, hero.HT / 4 )), new Chasm() );
}
public static void mobFall( Mob mob ) {

View File

@@ -277,7 +277,7 @@ public class SentryRoom extends SpecialRoom {
public void onZapComplete(){
if (hit(this, Dungeon.hero, true)) {
Dungeon.hero.damage(Random.NormalIntRange(2 + Dungeon.depth / 2, 4 + Dungeon.depth), new Eye.DeathGaze());
Dungeon.hero.damage(Char.combatRoll(2 + Dungeon.depth / 2, 4 + Dungeon.depth), new Eye.DeathGaze());
if (!Dungeon.hero.isAlive()) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(this);

View File

@@ -35,7 +35,6 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
public class DisintegrationTrap extends Trap {
@@ -74,7 +73,7 @@ public class DisintegrationTrap extends Trap {
Sample.INSTANCE.play(Assets.Sounds.RAY);
ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos), target.sprite.center()));
}
target.damage( Random.NormalIntRange(30, 50) + scalingDepth(), this );
target.damage( Char.combatRoll(30, 50) + scalingDepth(), this );
if (target == Dungeon.hero){
Hero hero = (Hero)target;
if (!hero.isAlive()){

View File

@@ -30,8 +30,8 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.utils.BArray;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.BArray;
import com.watabou.utils.PathFinder;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
@@ -75,7 +75,7 @@ public class GeyserTrap extends Trap {
//does the equivalent of a bomb's damage against fiery enemies.
if (Char.hasProp(ch, Char.Property.FIERY)){
int dmg = Random.NormalIntRange(5 + scalingDepth(), 10 + scalingDepth()*2);
int dmg = Char.combatRoll(5 + scalingDepth(), 10 + scalingDepth()*2);
dmg *= 0.67f;
if (!ch.isImmune(GeyserTrap.class)){
ch.damage(dmg, this);
@@ -117,7 +117,7 @@ public class GeyserTrap extends Trap {
//does the equivalent of a bomb's damage against fiery enemies.
if (Char.hasProp(ch, Char.Property.FIERY)){
int dmg = Random.NormalIntRange(5 + scalingDepth(), 10 + scalingDepth()*2);
int dmg = Char.combatRoll(5 + scalingDepth(), 10 + scalingDepth()*2);
if (!ch.isImmune(GeyserTrap.class)){
ch.damage(dmg, this);
}

View File

@@ -81,7 +81,7 @@ public class GnollRockfallTrap extends RockfallTrap {
if (ch != null && ch.isAlive() && !(ch instanceof GnollGeomancer)){
//deals notably less damage than a regular rockfall trap, but ignores armor
int damage = Random.NormalIntRange(6, 12);
int damage = Char.combatRoll(6, 12);
ch.damage( Math.max(damage, 0) , this);
//guards take full paralysis, otherwise just a little

Some files were not shown because too many files have changed in this diff Show More