v0.7.2: reworked enchantments! Still need to implement swift and a curse
This commit is contained in:
parent
c576a0e0b6
commit
f4c8a5336d
|
@ -122,6 +122,24 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming.class,
|
com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming.class,
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectCurse" );
|
"com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectCurse" );
|
||||||
|
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.curses.Elastic" );
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Dazzling" );
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Eldritch" );
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Stunning" );
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Venomous" );
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vorpal" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -170,7 +170,11 @@ public class Burning extends Buff implements Hero.Doom {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reignite( Char ch ) {
|
public void reignite( Char ch ) {
|
||||||
left = DURATION;
|
reignite( ch, DURATION );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reignite( Char ch, float duration ) {
|
||||||
|
left = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -94,6 +94,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMappi
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||||
|
@ -313,6 +316,18 @@ public class Hero extends Char {
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
KindOfWeapon wep = belongings.weapon;
|
KindOfWeapon wep = belongings.weapon;
|
||||||
|
|
||||||
|
if (wep instanceof Weapon
|
||||||
|
&& (((Weapon) wep).hasEnchant(Precise.class, this)
|
||||||
|
|| (((Weapon) wep).hasEnchant(Unstable.class, this) && Random.Int(11) == 0))){
|
||||||
|
if (Precise.rollToGuaranteeHit((Weapon) wep)){
|
||||||
|
target.sprite.emitter().start( Speck.factory(Speck.LIGHT), 0.05f, 5 );
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
if (((Weapon) wep).hasEnchant(Unstable.class, this)){
|
||||||
|
Unstable.justRolledPrecise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float accuracy = 1;
|
float accuracy = 1;
|
||||||
accuracy *= RingOfAccuracy.accuracyMultiplier( this );
|
accuracy *= RingOfAccuracy.accuracyMultiplier( this );
|
||||||
|
|
||||||
|
@ -352,7 +367,6 @@ public class Hero extends Char {
|
||||||
@Override
|
@Override
|
||||||
public int drRoll() {
|
public int drRoll() {
|
||||||
int dr = 0;
|
int dr = 0;
|
||||||
Barkskin bark = buff(Barkskin.class);
|
|
||||||
|
|
||||||
if (belongings.armor != null) {
|
if (belongings.armor != null) {
|
||||||
int armDr = Random.NormalIntRange( belongings.armor.DRMin(), belongings.armor.DRMax());
|
int armDr = Random.NormalIntRange( belongings.armor.DRMin(), belongings.armor.DRMax());
|
||||||
|
@ -368,8 +382,12 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
if (wepDr > 0) dr += wepDr;
|
if (wepDr > 0) dr += wepDr;
|
||||||
}
|
}
|
||||||
|
Barkskin bark = buff(Barkskin.class);
|
||||||
if (bark != null) dr += Random.NormalIntRange( 0 , bark.level() );
|
if (bark != null) dr += Random.NormalIntRange( 0 , bark.level() );
|
||||||
|
|
||||||
|
Blocking.BlockBuff block = buff(Blocking.BlockBuff.class);
|
||||||
|
if (block != null) dr += block.blockingRoll();
|
||||||
|
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourg
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
|
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -613,8 +614,6 @@ public abstract class Mob extends Char {
|
||||||
EXP /= 2;
|
EXP /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.die( cause );
|
|
||||||
|
|
||||||
if (alignment == Alignment.ENEMY){
|
if (alignment == Alignment.ENEMY){
|
||||||
rollToDropLoot();
|
rollToDropLoot();
|
||||||
}
|
}
|
||||||
|
@ -622,6 +621,8 @@ public abstract class Mob extends Char {
|
||||||
if (Dungeon.hero.isAlive() && !Dungeon.level.heroFOV[pos]) {
|
if (Dungeon.hero.isAlive() && !Dungeon.level.heroFOV[pos]) {
|
||||||
GLog.i( Messages.get(this, "died") );
|
GLog.i( Messages.get(this, "died") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.die( cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rollToDropLoot(){
|
public void rollToDropLoot(){
|
||||||
|
@ -646,13 +647,19 @@ public abstract class Mob extends Char {
|
||||||
if (bonus != null && !bonus.isEmpty()) {
|
if (bonus != null && !bonus.isEmpty()) {
|
||||||
for (Item b : bonus) Dungeon.level.drop(b, pos).sprite.drop();
|
for (Item b : bonus) Dungeon.level.drop(b, pos).sprite.drop();
|
||||||
if (RingOfWealth.latestDropWasRare){
|
if (RingOfWealth.latestDropWasRare){
|
||||||
new Flare(8, 48).color(0xAA00FF, true).show(sprite, 2f);
|
new Flare(8, 48).color(0xAA00FF, true).show(sprite, 3f);
|
||||||
RingOfWealth.latestDropWasRare = false;
|
RingOfWealth.latestDropWasRare = false;
|
||||||
} else {
|
} else {
|
||||||
new Flare(8, 24).color(0xFFFFFF, true).show(sprite, 2f);
|
new Flare(8, 24).color(0xFFFFFF, true).show(sprite, 3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lucky enchant logic
|
||||||
|
if (Dungeon.hero.lvl <= maxLvl && buff(Lucky.LuckProc.class) != null){
|
||||||
|
new Flare(8, 24).color(0x00FF00, true).show(sprite, 3f);
|
||||||
|
Dungeon.level.drop(Lucky.genLoot(), pos).sprite.drop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object loot = null;
|
protected Object loot = null;
|
||||||
|
|
|
@ -23,10 +23,13 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -89,6 +92,16 @@ public class Statue extends Mob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
|
if (weapon.hasEnchant(Precise.class, this)
|
||||||
|
|| (weapon.hasEnchant(Unstable.class, this) && Random.Int(11) == 0)){
|
||||||
|
if (Precise.rollToGuaranteeHit(weapon)){
|
||||||
|
target.sprite.emitter().start( Speck.factory(Speck.LIGHT), 0.05f, 5 );
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
if (weapon.hasEnchant(Unstable.class, this)){
|
||||||
|
Unstable.justRolledPrecise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return (int)((9 + Dungeon.depth) * weapon.accuracyFactor(this));
|
return (int)((9 + Dungeon.depth) * weapon.accuracyFactor(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPsionicBlast;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPsionicBlast;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
@ -492,6 +494,19 @@ public class DriedRose extends Artifact {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int attackSkill(Char target) {
|
public int attackSkill(Char target) {
|
||||||
|
|
||||||
|
if (rose != null && rose.weapon != null
|
||||||
|
&& (rose.weapon.hasEnchant(Precise.class, this)
|
||||||
|
|| rose.weapon.hasEnchant(Unstable.class, this) && Random.Int(11) == 0)){
|
||||||
|
if (Precise.rollToGuaranteeHit(rose.weapon)){
|
||||||
|
target.sprite.emitter().start( Speck.factory(Speck.LIGHT), 0.05f, 5 );
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
if (rose.weapon.hasEnchant(Unstable.class, this)){
|
||||||
|
Unstable.justRolledPrecise = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//same accuracy as the hero.
|
//same accuracy as the hero.
|
||||||
int acc = Dungeon.hero.lvl + 9;
|
int acc = Dungeon.hero.lvl + 9;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Effects;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Effects;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -147,18 +148,8 @@ public class WandOfBlastWave extends DamageWand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//behaves just like glyph of Repulsion
|
|
||||||
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
|
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
|
||||||
int level = Math.max(0, staff.level());
|
new Elastic().proc(staff, attacker, defender, damage);
|
||||||
|
|
||||||
// lvl 0 - 25%
|
|
||||||
// lvl 1 - 40%
|
|
||||||
// lvl 2 - 50%
|
|
||||||
if (Random.Int( level + 4 ) >= 3){
|
|
||||||
int oppositeHero = defender.pos + (defender.pos - attacker.pos);
|
|
||||||
Ballistica trajectory = new Ballistica(defender.pos, oppositeHero, Ballistica.MAGIC_BOLT);
|
|
||||||
throwChar(defender, trajectory, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,17 +27,16 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blooming;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
@ -193,18 +192,7 @@ public class WandOfRegrowth extends Wand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
|
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
|
||||||
//like pre-nerf vampiric enchantment, except with herbal healing buff
|
new Blooming().proc(staff, attacker, defender, damage);
|
||||||
|
|
||||||
int level = Math.max( 0, staff.level() );
|
|
||||||
|
|
||||||
// lvl 0 - 33%
|
|
||||||
// lvl 1 - 43%
|
|
||||||
// lvl 2 - 50%
|
|
||||||
int maxValue = damage * (level + 2) / (level + 6);
|
|
||||||
int effValue = Math.min( Random.IntRange(0, maxValue), attacker.HT - attacker.HP );
|
|
||||||
|
|
||||||
Buff.affect(attacker, Sungrass.Health.class).boost( effValue );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fx( Ballistica bolt, Callback callback ) {
|
protected void fx( Ballistica bolt, Callback callback ) {
|
||||||
|
|
|
@ -32,25 +32,23 @@ import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Annoying;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Annoying;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Elastic;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Friendly;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Friendly;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blooming;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Dazzling;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Eldritch;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Stunning;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Venomous;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vorpal;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
@ -297,14 +295,14 @@ abstract public class Weapon extends KindOfWeapon {
|
||||||
public static abstract class Enchantment implements Bundlable {
|
public static abstract class Enchantment implements Bundlable {
|
||||||
|
|
||||||
private static final Class<?>[] common = new Class<?>[]{
|
private static final Class<?>[] common = new Class<?>[]{
|
||||||
Blazing.class, Venomous.class, Vorpal.class, Shocking.class};
|
Blazing.class, Chilling.class, Shocking.class, Blooming.class};
|
||||||
|
|
||||||
private static final Class<?>[] uncommon = new Class<?>[]{
|
private static final Class<?>[] uncommon = new Class<?>[]{
|
||||||
Chilling.class, Eldritch.class, Lucky.class,
|
/*Swift.class,*/ Elastic.class, Projecting.class,
|
||||||
Projecting.class, Unstable.class, Dazzling.class};
|
Unstable.class, Precise.class, Blocking.class};
|
||||||
|
|
||||||
private static final Class<?>[] rare = new Class<?>[]{
|
private static final Class<?>[] rare = new Class<?>[]{
|
||||||
Grim.class, Stunning.class, Vampiric.class};
|
Grim.class, Vampiric.class, Lucky.class};
|
||||||
|
|
||||||
private static final float[] typeChances = new float[]{
|
private static final float[] typeChances = new float[]{
|
||||||
50, //12.5% each
|
50, //12.5% each
|
||||||
|
@ -314,7 +312,7 @@ abstract public class Weapon extends KindOfWeapon {
|
||||||
|
|
||||||
private static final Class<?>[] curses = new Class<?>[]{
|
private static final Class<?>[] curses = new Class<?>[]{
|
||||||
Annoying.class, Displacing.class, Exhausting.class, Fragile.class,
|
Annoying.class, Displacing.class, Exhausting.class, Fragile.class,
|
||||||
Sacrificial.class, Wayward.class, Elastic.class, Friendly.class
|
Sacrificial.class, Wayward.class, /*Shifting.class,*/ Friendly.class
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
*
|
*
|
||||||
* Shattered Pixel Dungeon
|
* Shattered Pixel Dungeon
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,23 +22,17 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
|
||||||
public class Elastic extends Weapon.Enchantment {
|
public class Shifting extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
|
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
|
//TODO implement
|
||||||
int oppositeDefender = defender.pos + (defender.pos - attacker.pos);
|
return damage;
|
||||||
Ballistica trajectory = new Ballistica(defender.pos, oppositeDefender, Ballistica.MAGIC_BOLT);
|
|
||||||
WandOfBlastWave.throwChar(defender, trajectory, 2);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,5 +44,4 @@ public class Elastic extends Weapon.Enchantment {
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return BLACK;
|
return BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||||
|
@ -43,10 +44,11 @@ public class Blazing extends Weapon.Enchantment {
|
||||||
|
|
||||||
if (Random.Int( level + 3 ) >= 2) {
|
if (Random.Int( level + 3 ) >= 2) {
|
||||||
|
|
||||||
if (Random.Int( 2 ) == 0) {
|
if (defender.buff(Burning.class) != null || Dungeon.level.flamable[defender.pos]){
|
||||||
Buff.affect( defender, Burning.class ).reignite( defender );
|
Buff.affect(defender, Burning.class).reignite(defender, 8f);
|
||||||
|
} else {
|
||||||
|
Buff.affect(defender, Burning.class).reignite(defender, 4f);
|
||||||
}
|
}
|
||||||
defender.damage( Random.Int( 1, level + 2 ), this );
|
|
||||||
|
|
||||||
defender.sprite.emitter().burst( FlameParticle.FACTORY, level + 1 );
|
defender.sprite.emitter().burst( FlameParticle.FACTORY, level + 1 );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
public class Blocking extends Weapon.Enchantment {
|
||||||
|
|
||||||
|
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0000FF );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
|
|
||||||
|
int level = Math.max( 0, weapon.level() );
|
||||||
|
|
||||||
|
Buff.prolong(attacker, BlockBuff.class, 1 + level/2).setBlocking(level + 1);
|
||||||
|
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemSprite.Glowing glowing() {
|
||||||
|
return BLUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BlockBuff extends FlavourBuff {
|
||||||
|
|
||||||
|
private int blocking = 0;
|
||||||
|
|
||||||
|
public void setBlocking( int blocking ){
|
||||||
|
this.blocking = blocking;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int blockingRoll(){
|
||||||
|
return Random.NormalIntRange(0, blocking);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int icon() {
|
||||||
|
return BuffIndicator.ARMOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tintIcon(Image icon) {
|
||||||
|
icon.tint(0, 0.5f, 1, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Messages.get(this, "name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return Messages.get(this, "desc", blocking, dispTurns());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String BLOCKING = "blocking";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void storeInBundle(Bundle bundle) {
|
||||||
|
super.storeInBundle(bundle);
|
||||||
|
bundle.put(BLOCKING, blocking);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
|
super.restoreFromBundle(bundle);
|
||||||
|
blocking = bundle.getInt(BLOCKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
*
|
*
|
||||||
* Shattered Pixel Dungeon
|
* Shattered Pixel Dungeon
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,22 +21,27 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Venomous extends Weapon.Enchantment {
|
import java.util.ArrayList;
|
||||||
|
|
||||||
private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x4400AA );
|
public class Blooming extends Weapon.Enchantment {
|
||||||
|
|
||||||
|
private static ItemSprite.Glowing DARK_GREEN = new ItemSprite.Glowing( 0x008800 );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
|
|
||||||
// lvl 0 - 33%
|
// lvl 0 - 33%
|
||||||
// lvl 1 - 50%
|
// lvl 1 - 50%
|
||||||
// lvl 2 - 60%
|
// lvl 2 - 60%
|
||||||
|
@ -44,16 +49,38 @@ public class Venomous extends Weapon.Enchantment {
|
||||||
|
|
||||||
if (Random.Int( level + 3 ) >= 2) {
|
if (Random.Int( level + 3 ) >= 2) {
|
||||||
|
|
||||||
Buff.affect( defender, Poison.class ).extend( ((level/2) + 1) );
|
if (!plantGrass(defender.pos)){
|
||||||
CellEmitter.center(defender.pos).burst( PoisonParticle.SPLASH, 5 );
|
ArrayList<Integer> positions = new ArrayList<>();
|
||||||
|
for (int i : PathFinder.NEIGHBOURS8){
|
||||||
|
positions.add(i);
|
||||||
|
}
|
||||||
|
Random.shuffle( positions );
|
||||||
|
for (int i : positions){
|
||||||
|
if (plantGrass(defender.pos + i)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean plantGrass(int cell){
|
||||||
|
int c = Dungeon.level.map[cell];
|
||||||
|
if ( c == Terrain.EMPTY || c == Terrain.EMPTY_DECO
|
||||||
|
|| c == Terrain.EMBERS || c == Terrain.GRASS){
|
||||||
|
Level.set(cell, Terrain.HIGH_GRASS);
|
||||||
|
GameScene.updateMap(cell);
|
||||||
|
CellEmitter.get( cell ).burst( LeafParticle.LEVEL_SPECIFIC, 4 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return PURPLE;
|
return DARK_GREEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -36,15 +36,15 @@ public class Chilling extends Weapon.Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
// lvl 0 - 20%
|
// lvl 0 - 33%
|
||||||
// lvl 1 - 33%
|
// lvl 1 - 50%
|
||||||
// lvl 2 - 43%
|
// lvl 2 - 60%
|
||||||
int level = Math.max( 0, weapon.level() );
|
int level = Math.max( 0, weapon.level() );
|
||||||
|
|
||||||
if (Random.Int( level + 5 ) >= 4) {
|
if (Random.Int( level + 3 ) >= 2) {
|
||||||
|
|
||||||
//FIXME this should probably stack chilled
|
//FIXME this should probably stack chilled
|
||||||
Buff.prolong( defender, Chill.class, Random.Float( 2f, 3f ) );
|
Buff.affect( defender, Chill.class, 3f + level/4f );
|
||||||
Splash.at( defender.sprite.center(), 0xFFB2D6FF, 5);
|
Splash.at( defender.sprite.center(), 0xFFB2D6FF, 5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
*
|
*
|
||||||
* Shattered Pixel Dungeon
|
* Shattered Pixel Dungeon
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,31 +22,27 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Dazzling extends Weapon.Enchantment {
|
public class Elastic extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xFFFF00 );
|
private static ItemSprite.Glowing PINK = new ItemSprite.Glowing( 0xFF00FF );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
// lvl 0 - 20%
|
// lvl 0 - 20%
|
||||||
// lvl 1 - 33%
|
// lvl 1 - 33%
|
||||||
// lvl 2 - 43%
|
// lvl 2 - 43%
|
||||||
int level = Math.max( 0, weapon.level() );
|
int level = Math.max( 0, weapon.level() );
|
||||||
|
|
||||||
if (Random.Int( level + 5 ) >= 4) {
|
if (Random.Int( level + 5 ) >= 4) {
|
||||||
|
int oppositeDefender = defender.pos + (defender.pos - attacker.pos);
|
||||||
Buff.prolong( defender, Blindness.class, Random.Float( 1f, 1f + level ) );
|
Ballistica trajectory = new Ballistica(defender.pos, oppositeDefender, Ballistica.MAGIC_BOLT);
|
||||||
Buff.prolong( defender, Cripple.class, Random.Float( 1f, 1f + level/2f ) );
|
WandOfBlastWave.throwChar(defender, trajectory, 2);
|
||||||
defender.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
|
@ -54,7 +50,7 @@ public class Dazzling extends Weapon.Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return YELLOW;
|
return PINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
* Pixel Dungeon
|
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
|
||||||
*
|
|
||||||
* Shattered Pixel Dungeon
|
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
|
||||||
import com.watabou.utils.Random;
|
|
||||||
|
|
||||||
public class Eldritch extends Weapon.Enchantment {
|
|
||||||
|
|
||||||
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 );
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
|
||||||
// lvl 0 - 20%
|
|
||||||
// lvl 1 - 33%
|
|
||||||
// lvl 2 - 43%
|
|
||||||
int level = Math.max( 0, weapon.level() );
|
|
||||||
|
|
||||||
if (Random.Int( level + 5 ) >= 4) {
|
|
||||||
|
|
||||||
if (defender == Dungeon.hero) {
|
|
||||||
Buff.affect( defender, Vertigo.class, Vertigo.DURATION );
|
|
||||||
} else {
|
|
||||||
//damage will reduce by 5 turns, so effectively 10 turns of terror
|
|
||||||
Buff.affect( defender, Terror.class, 10f + 5f ).object = attacker.id();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Glowing glowing() {
|
|
||||||
return GREY;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,15 +42,19 @@ public class Grim extends Weapon.Enchantment {
|
||||||
int enemyHealth = defender.HP - damage;
|
int enemyHealth = defender.HP - damage;
|
||||||
if (enemyHealth == 0) return damage; //no point in proccing if they're already dead.
|
if (enemyHealth == 0) return damage; //no point in proccing if they're already dead.
|
||||||
|
|
||||||
//scales from 0 - 30% based on how low hp the enemy is, plus 1% per level
|
//scales from 0 - 40% based on how low hp the enemy is, plus 2% per level
|
||||||
int chance = Math.round(((defender.HT - enemyHealth) / (float)defender.HT)*30 + level);
|
float maxChance = 0.4f + .02f*level;
|
||||||
|
float chanceMulti = (float)Math.pow( ((defender.HT - enemyHealth) / (float)defender.HT), 2);
|
||||||
|
float chance = maxChance * chanceMulti;
|
||||||
|
|
||||||
if (Random.Int( 100 ) < chance) {
|
if (Random.Float() < chance) {
|
||||||
|
|
||||||
defender.damage( defender.HP, this );
|
defender.damage( defender.HP, this );
|
||||||
defender.sprite.emitter().burst( ShadowParticle.UP, 5 );
|
defender.sprite.emitter().burst( ShadowParticle.UP, 5 );
|
||||||
|
|
||||||
if (!defender.isAlive() && attacker instanceof Hero) {
|
if (!defender.isAlive() && attacker instanceof Hero
|
||||||
|
//this prevents unstable from triggering grim achievement
|
||||||
|
&& weapon.hasEnchant(Grim.class, attacker)) {
|
||||||
Badges.validateGrimWeapon();
|
Badges.validateGrimWeapon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||||
import com.watabou.utils.Bundle;
|
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Lucky extends Weapon.Enchantment {
|
public class Lucky extends Weapon.Enchantment {
|
||||||
|
@ -37,28 +39,30 @@ public class Lucky extends Weapon.Enchantment {
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
int level = Math.max( 0, weapon.level() );
|
int level = Math.max( 0, weapon.level() );
|
||||||
|
|
||||||
float zeroChance = 0.5f;
|
//5% chance, + 1% per weapon level
|
||||||
|
if (defender.HP <= damage && Random.Float() < (0.05f + .01f*level)){
|
||||||
Luck buff = attacker.buff(Luck.class);
|
Buff.affect(defender, LuckProc.class);
|
||||||
if (buff != null){
|
|
||||||
zeroChance = buff.zeroChance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Random.Float() >= zeroChance){
|
return damage;
|
||||||
|
|
||||||
if (buff != null) {
|
}
|
||||||
buff.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 2*damage;
|
public static Item genLoot(){
|
||||||
|
float roll = Random.Float();
|
||||||
|
if (roll < 0.6f){
|
||||||
|
Item result = new Gold().random();
|
||||||
|
result.quantity(Math.round(result.quantity() * 0.5f));
|
||||||
|
return result;
|
||||||
|
} else if (roll < 0.9f){
|
||||||
|
return Random.Int(2) == 0
|
||||||
|
? Generator.random(Generator.Category.SEED)
|
||||||
|
: Generator.random(Generator.Category.STONE);
|
||||||
} else {
|
} else {
|
||||||
|
return Random.Int(2) == 0
|
||||||
buff = Buff.affect(attacker, Luck.class);
|
? Generator.random(Generator.Category.POTION)
|
||||||
buff.zeroChance = zeroChance * (0.5f - (0.01f*level));
|
: Generator.random(Generator.Category.SCROLL);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,39 +70,14 @@ public class Lucky extends Weapon.Enchantment {
|
||||||
return GREEN;
|
return GREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//used to keep track of whether a luck proc is incoming. see Mob.die()
|
||||||
public static class Luck extends Buff {
|
public static class LuckProc extends Buff {
|
||||||
|
|
||||||
float zeroChance;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
|
detach();
|
||||||
zeroChance += 0.01f;
|
|
||||||
|
|
||||||
if (zeroChance >= 0.5f){
|
|
||||||
detach();
|
|
||||||
} else {
|
|
||||||
spend(TICK);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String CHANCE = "chance";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void restoreFromBundle(Bundle bundle) {
|
|
||||||
super.restoreFromBundle(bundle);
|
|
||||||
zeroChance = bundle.getFloat(CHANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void storeInBundle(Bundle bundle) {
|
|
||||||
super.storeInBundle(bundle);
|
|
||||||
bundle.put(CHANCE, zeroChance);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
*
|
*
|
||||||
* Shattered Pixel Dungeon
|
* Shattered Pixel Dungeon
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,37 +22,35 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Stunning extends Weapon.Enchantment {
|
public class Precise extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xCCAA44 );
|
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
//called from attackSkill in Hero, Statue, and GhostHero
|
||||||
|
public static boolean rollToGuaranteeHit( Weapon weapon ){
|
||||||
// lvl 0 - 13%
|
// lvl 0 - 13%
|
||||||
// lvl 1 - 22%
|
// lvl 1 - 22%
|
||||||
// lvl 2 - 30%
|
// lvl 2 - 30%
|
||||||
int level = Math.max( 0, weapon.level() );
|
int level = Math.max( 0, weapon.level() );
|
||||||
|
|
||||||
if (Random.Int( level + 8 ) >= 7) {
|
if (Random.Int( level + 80 ) >= 7) {
|
||||||
|
return true;
|
||||||
Buff.prolong( defender, Paralysis.class, Random.Float( 1, 1.5f + level ) );
|
|
||||||
defender.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 12 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return damage;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return YELLOW;
|
return WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
|
||||||
public class Projecting extends Weapon.Enchantment {
|
public class Projecting extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x888888 );
|
private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x8844CC );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
|
@ -38,7 +38,7 @@ public class Projecting extends Weapon.Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return GREY;
|
return PURPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class Shocking extends Weapon.Enchantment {
|
public class Shocking extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF, 0.6f );
|
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF, 0.5f );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
|
@ -47,11 +48,15 @@ public class Shocking extends Weapon.Enchantment {
|
||||||
if (Random.Int( level + 3 ) >= 2) {
|
if (Random.Int( level + 3 ) >= 2) {
|
||||||
|
|
||||||
affected.clear();
|
affected.clear();
|
||||||
affected.add(attacker);
|
|
||||||
|
|
||||||
arcs.clear();
|
arcs.clear();
|
||||||
arcs.add(new Lightning.Arc(attacker.sprite.center(), defender.sprite.center()));
|
arcs.add(new Lightning.Arc(attacker.sprite.center(), defender.sprite.center()));
|
||||||
hit(defender, Random.Int(1, damage / 3));
|
arc(attacker, defender, 2);
|
||||||
|
|
||||||
|
affected.remove(defender); //defender isn't hurt by lightning
|
||||||
|
for (Char ch : affected) {
|
||||||
|
ch.damage((int)Math.ceil(damage/3f), this);
|
||||||
|
}
|
||||||
|
|
||||||
attacker.sprite.parent.addToFront( new Lightning( arcs, null ) );
|
attacker.sprite.parent.addToFront( new Lightning( arcs, null ) );
|
||||||
|
|
||||||
|
@ -70,23 +75,21 @@ public class Shocking extends Weapon.Enchantment {
|
||||||
|
|
||||||
private ArrayList<Lightning.Arc> arcs = new ArrayList<>();
|
private ArrayList<Lightning.Arc> arcs = new ArrayList<>();
|
||||||
|
|
||||||
private void hit( Char ch, int damage ) {
|
private void arc( Char attacker, Char defender, int dist ) {
|
||||||
|
|
||||||
if (damage < 1) {
|
affected.add(defender);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
affected.add(ch);
|
defender.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
|
||||||
ch.damage(Dungeon.level.water[ch.pos] && !ch.flying ? 2*damage : damage, this);
|
defender.sprite.flash();
|
||||||
|
|
||||||
ch.sprite.centerEmitter().burst(SparkParticle.FACTORY, 3);
|
PathFinder.buildDistanceMap( defender.pos, BArray.not( Dungeon.level.solid, null ), dist );
|
||||||
ch.sprite.flash();
|
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||||
|
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||||
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
|
Char n = Actor.findChar(i);
|
||||||
Char n = Actor.findChar( ch.pos + PathFinder.NEIGHBOURS8[i] );
|
if (n != null && n != attacker && !affected.contains(n)) {
|
||||||
if (n != null && !affected.contains( n )) {
|
arcs.add(new Lightning.Arc(defender.sprite.center(), n.sprite.center()));
|
||||||
arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
|
arc(attacker, n, (Dungeon.level.water[n.pos] && !n.flying) ? 2 : 1);
|
||||||
hit(n, Random.Int(damage / 2, damage));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
*
|
*
|
||||||
* Shattered Pixel Dungeon
|
* Shattered Pixel Dungeon
|
||||||
* Copyright (C) 2014-2019 Evan Debenham
|
* Copyright (C) 2014-2018 Evan Debenham
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,39 +22,23 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.watabou.utils.PointF;
|
|
||||||
import com.watabou.utils.Random;
|
|
||||||
|
|
||||||
public class Vorpal extends Weapon.Enchantment {
|
public class Swift extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0xAA6666 );
|
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xFFFF00 );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||||
// lvl 0 - 33%
|
|
||||||
// lvl 1 - 50%
|
|
||||||
// lvl 2 - 60%
|
|
||||||
int level = Math.max( 0, weapon.level() );
|
|
||||||
|
|
||||||
if (Random.Int( level + 3 ) >= 2) {
|
|
||||||
|
|
||||||
Buff.affect(defender, Bleeding.class).set(damage/5f);
|
|
||||||
Splash.at( defender.sprite.center(), -PointF.PI / 2, PointF.PI / 6,
|
|
||||||
defender.sprite.blood(), 10 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return RED;
|
return YELLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -29,25 +29,32 @@ import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class Unstable extends Weapon.Enchantment {
|
public class Unstable extends Weapon.Enchantment {
|
||||||
|
|
||||||
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
|
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x999999 );
|
||||||
|
|
||||||
private static Class<?extends Weapon.Enchantment>[] randomEnchants = new Class[]{
|
private static Class<?extends Weapon.Enchantment>[] randomEnchants = new Class[]{
|
||||||
Blazing.class,
|
Blazing.class,
|
||||||
|
Blocking.class,
|
||||||
|
Blooming.class,
|
||||||
Chilling.class,
|
Chilling.class,
|
||||||
Dazzling.class,
|
Elastic.class,
|
||||||
Eldritch.class,
|
|
||||||
Grim.class,
|
Grim.class,
|
||||||
Lucky.class,
|
Lucky.class,
|
||||||
|
//precise also not included here, is manually check in attackSkill
|
||||||
//projecting not included, no on-hit effect
|
//projecting not included, no on-hit effect
|
||||||
Shocking.class,
|
Shocking.class,
|
||||||
Stunning.class,
|
//Swift.class,
|
||||||
Vampiric.class,
|
Vampiric.class
|
||||||
Venomous.class,
|
|
||||||
Vorpal.class
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static boolean justRolledPrecise;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
|
if (justRolledPrecise){
|
||||||
|
justRolledPrecise = false;
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Random.oneOf(randomEnchants).newInstance().proc( weapon, attacker, defender, damage );
|
return Random.oneOf(randomEnchants).newInstance().proc( weapon, attacker, defender, damage );
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -58,6 +65,6 @@ public class Unstable extends Weapon.Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return WHITE;
|
return GREY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||||
import com.watabou.utils.Random;
|
|
||||||
|
|
||||||
public class Vampiric extends Weapon.Enchantment {
|
public class Vampiric extends Weapon.Enchantment {
|
||||||
|
|
||||||
|
@ -36,19 +35,16 @@ public class Vampiric extends Weapon.Enchantment {
|
||||||
@Override
|
@Override
|
||||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||||
|
|
||||||
int level = Math.max( 0, weapon.level() );
|
//heals for 0-10% of damage dealt, based on missing HP
|
||||||
|
float missingPercent = (attacker.HT - attacker.HP) / (float)defender.HT;
|
||||||
|
float healValue = missingPercent * 0.1f;
|
||||||
|
int healAmt = Math.round(healValue * damage);
|
||||||
|
|
||||||
// lvl 0 - 16%
|
if (healAmt > 0) {
|
||||||
// lvl 1 - 17.65%
|
|
||||||
// lvl 2 - 19.23%
|
|
||||||
int maxValue = Math.round(damage * ((level + 8) / (float)(level + 50)));
|
|
||||||
int effValue = Math.min( Random.IntRange( 0, maxValue ), attacker.HT - attacker.HP );
|
|
||||||
|
|
||||||
if (effValue > 0) {
|
attacker.HP += healAmt;
|
||||||
|
|
||||||
attacker.HP += effValue;
|
|
||||||
attacker.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
|
attacker.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
|
||||||
attacker.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( effValue ) );
|
attacker.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healAmt ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1143,9 +1143,6 @@ items.weapon.curses.annoying.desc=Annoying weapons are capable of speech, but th
|
||||||
items.weapon.curses.displacing.name=displacing %s
|
items.weapon.curses.displacing.name=displacing %s
|
||||||
items.weapon.curses.displacing.desc=Displacing weapons are infused with chaotic teleportation magic, possessing the ability to warp enemies around the floor randomly.
|
items.weapon.curses.displacing.desc=Displacing weapons are infused with chaotic teleportation magic, possessing the ability to warp enemies around the floor randomly.
|
||||||
|
|
||||||
items.weapon.curses.elastic.name=elastic %s
|
|
||||||
items.weapon.curses.elastic.desc=Elastic weapons aren't able to deal any damage, but can send enemies flying back short distances.
|
|
||||||
|
|
||||||
items.weapon.curses.exhausting.name=exhausting %s
|
items.weapon.curses.exhausting.name=exhausting %s
|
||||||
items.weapon.curses.exhausting.desc=Exhausting weapons take great effort to use, and will periodically weaken the wearer as a result.
|
items.weapon.curses.exhausting.desc=Exhausting weapons take great effort to use, and will periodically weaken the wearer as a result.
|
||||||
|
|
||||||
|
@ -1166,20 +1163,28 @@ items.weapon.curses.wayward.desc=A wayward weapon has a very hard time finding i
|
||||||
items.weapon.enchantments.blazing.name=blazing %s
|
items.weapon.enchantments.blazing.name=blazing %s
|
||||||
items.weapon.enchantments.blazing.desc=This enchantment causes flames to spit forth from a weapon, burning enemies and terrain alike.
|
items.weapon.enchantments.blazing.desc=This enchantment causes flames to spit forth from a weapon, burning enemies and terrain alike.
|
||||||
|
|
||||||
|
items.weapon.enchantments.blocking.name=blocking %s
|
||||||
|
items.weapon.enchantments.blocking.desc=This enchantment will enhance your ability to defend yourself after attacking with this weapon.
|
||||||
|
items.weapon.enchantments.blocking$blockbuff.name=Blocking
|
||||||
|
items.weapon.enchantments.blocking$blockbuff.desc=Your weapon's blocking enchantment has given you a short boost of defensive power!\n\nBlocking boost: 0-%d\n\nTurns remaining: %s.
|
||||||
|
|
||||||
|
items.weapon.enchantments.blooming.name=blooming %s
|
||||||
|
items.weapon.enchantments.blooming.desc=Blooming weapons contain magic which will cause vegetation to sprout on or around those struck by it.
|
||||||
|
|
||||||
items.weapon.enchantments.chilling.name=chilling %s
|
items.weapon.enchantments.chilling.name=chilling %s
|
||||||
items.weapon.enchantments.chilling.desc=Enemies struck with this enchantment are chilled, slowing their movement and attacks.
|
items.weapon.enchantments.chilling.desc=Enemies struck with this enchantment are chilled, slowing their movement and attacks.
|
||||||
|
|
||||||
items.weapon.enchantments.dazzling.name=dazzling %s
|
items.weapon.enchantments.elastic.name=elastic %s
|
||||||
items.weapon.enchantments.dazzling.desc=This enchantment dazes enemies when they are struck, rendering them blind for a short time.
|
items.weapon.enchantments.elastic.desc=Elastic weapons have a chance to send enemies flying back short distances.
|
||||||
|
|
||||||
items.weapon.enchantments.eldritch.name=eldritch %s
|
|
||||||
items.weapon.enchantments.eldritch.desc=Eldritch weapons strike fear into enemies, causing them to flee from the attacker.
|
|
||||||
|
|
||||||
items.weapon.enchantments.grim.name=grim %s
|
items.weapon.enchantments.grim.name=grim %s
|
||||||
items.weapon.enchantments.grim.desc=This powerful enchantment possesses the power to instantly execute an enemy. The effect is more likely to occur the weaker the enemy is.
|
items.weapon.enchantments.grim.desc=This powerful enchantment possesses the power to instantly execute an enemy. The effect is more likely to occur the weaker the enemy is.
|
||||||
|
|
||||||
items.weapon.enchantments.lucky.name=lucky %s
|
items.weapon.enchantments.lucky.name=lucky %s
|
||||||
items.weapon.enchantments.lucky.desc=A lucky weapon will deal either double damage or no damage. The odds become tipped in your favour every time an attack deals no damage.
|
items.weapon.enchantments.lucky.desc=This powerful enchantment increases the fortune of whoever wields it. Enemies which are killed with a lucky weapon have a chance to drop extra loot.
|
||||||
|
|
||||||
|
items.weapon.enchantments.precise.name=precise %s
|
||||||
|
items.weapon.enchantments.precise.desc=A precise weapon has a chance to guarantee a hit on an enemy, regardless of the circumstances.
|
||||||
|
|
||||||
items.weapon.enchantments.projecting.name=projecting %s
|
items.weapon.enchantments.projecting.name=projecting %s
|
||||||
items.weapon.enchantments.projecting.desc=With this enchantment melee weapons will gain extra reach. Ranged weapons will be able to penetrate nearby walls.
|
items.weapon.enchantments.projecting.desc=With this enchantment melee weapons will gain extra reach. Ranged weapons will be able to penetrate nearby walls.
|
||||||
|
@ -1187,9 +1192,6 @@ items.weapon.enchantments.projecting.desc=With this enchantment melee weapons wi
|
||||||
items.weapon.enchantments.shocking.name=shocking %s
|
items.weapon.enchantments.shocking.name=shocking %s
|
||||||
items.weapon.enchantments.shocking.desc=Electricity arcs from a shocking weapon, dealing extra damage to all nearby enemies.
|
items.weapon.enchantments.shocking.desc=Electricity arcs from a shocking weapon, dealing extra damage to all nearby enemies.
|
||||||
|
|
||||||
items.weapon.enchantments.stunning.name=stunning %s
|
|
||||||
items.weapon.enchantments.stunning.desc=This powerful enchantment immobilizes enemies when they are struck, rendering them helpless against further attacks.
|
|
||||||
|
|
||||||
items.weapon.enchantments.unstable.name=unstable %s
|
items.weapon.enchantments.unstable.name=unstable %s
|
||||||
items.weapon.enchantments.unstable.desc=This enchantment radiates chaotic energy, acting as a different enchantment with each hit.
|
items.weapon.enchantments.unstable.desc=This enchantment radiates chaotic energy, acting as a different enchantment with each hit.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user