v0.4.0: reworked enchants
This commit is contained in:
parent
d18417f447
commit
e3a3428f97
|
@ -53,7 +53,7 @@ public class Bleeding extends Buff {
|
|||
}
|
||||
|
||||
public void set( int level ) {
|
||||
this.level = level;
|
||||
this.level = Math.max(this.level, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,7 +56,11 @@ public class Poison extends Buff implements Hero.Doom {
|
|||
}
|
||||
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
this.left = Math.max(duration, left);
|
||||
}
|
||||
|
||||
public void extend( float duration ) {
|
||||
this.left += duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -469,10 +469,14 @@ public class Item implements Bundlable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int throwPos( Hero user, int dst){
|
||||
return new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos;
|
||||
}
|
||||
|
||||
public void cast( final Hero user, int dst ) {
|
||||
|
||||
final int cell = new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos;
|
||||
final int cell = throwPos( user, dst );
|
||||
user.sprite.zap( cell );
|
||||
user.busy();
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ abstract public class KindOfWeapon extends EquipableItem {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -152,11 +152,12 @@ public class Pickaxe extends Weapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
if (!bloodStained && defender instanceof Bat && (defender.HP <= damage)) {
|
||||
bloodStained = true;
|
||||
updateQuickslot();
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static final String BLOODSTAINED = "bloodStained";
|
||||
|
|
|
@ -31,14 +31,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Dazzling;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Eldritch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
||||
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.Vampiric;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Venomous;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vorpal;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -68,10 +71,10 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
public Enchantment enchantment;
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
|
||||
if (enchantment != null) {
|
||||
enchantment.proc( this, attacker, defender, damage );
|
||||
damage = enchantment.proc( this, attacker, defender, damage );
|
||||
}
|
||||
|
||||
if (!levelKnown) {
|
||||
|
@ -81,6 +84,8 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
Badges.validateItemLevelAquired( this );
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static final String UNFAMILIRIARITY = "unfamiliarity";
|
||||
|
@ -149,7 +154,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
|
||||
@Override
|
||||
public int reachFactor(Hero hero) {
|
||||
return RCH;
|
||||
return enchantment instanceof Projecting ? RCH+1 : RCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -246,11 +251,15 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
public static abstract class Enchantment implements Bundlable {
|
||||
|
||||
private static final Class<?>[] enchants = new Class<?>[]{
|
||||
Blazing.class, Venomous.class, Grim.class, Stunning.class, Vampiric.class,
|
||||
Chilling.class, Shocking.class, Unstable.class, Eldritch.class, Lucky.class };
|
||||
private static final float[] chances= new float[]{ 10, 10, 1, 2, 1, 2, 6, 3, 2, 2 };
|
||||
Blazing.class, Venomous.class, Vorpal.class, Shocking.class,
|
||||
Chilling.class, Eldritch.class, Lucky.class, Projecting.class, Unstable.class, Dazzling.class,
|
||||
Grim.class, Stunning.class, Vampiric.class,};
|
||||
private static final float[] chances= new float[]{
|
||||
10, 10, 10, 10,
|
||||
5, 5, 5, 5, 5, 5,
|
||||
2, 2, 2 };
|
||||
|
||||
public abstract boolean proc( Weapon weapon, Char attacker, Char defender, int damage );
|
||||
public abstract int proc( Weapon weapon, Char attacker, Char defender, int damage );
|
||||
|
||||
public String name( String weaponName ) {
|
||||
return Messages.get(this, "name", weaponName);
|
||||
|
@ -264,9 +273,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
public void storeInBundle( Bundle bundle ) {
|
||||
}
|
||||
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return ItemSprite.Glowing.WHITE;
|
||||
}
|
||||
public abstract ItemSprite.Glowing glowing();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Enchantment random() {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Blazing extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing ORANGE = new ItemSprite.Glowing( 0xFF4400 );
|
||||
|
||||
@Override
|
||||
public boolean 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%
|
||||
|
@ -49,13 +49,10 @@ public class Blazing extends Weapon.Enchantment {
|
|||
|
||||
defender.sprite.emitter().burst( FlameParticle.FACTORY, level + 1 );
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,29 +30,28 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class Chilling extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0044FF );
|
||||
private static ItemSprite.Glowing TEAL = new ItemSprite.Glowing( 0x00FFFF );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
// lvl 0 - 25%
|
||||
// lvl 1 - 40%
|
||||
// lvl 2 - 50%
|
||||
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 + 4 ) >= 3) {
|
||||
if (Random.Int( level + 5 ) >= 4) {
|
||||
|
||||
Buff.affect( defender, Chill.class,
|
||||
Random.Float( 1, 3f ) );
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
Buff.prolong( defender, Chill.class,
|
||||
Random.Float( 2f, 3f ) );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return BLUE;
|
||||
return TEAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2016 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.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Dazzling extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xFFFF00 );
|
||||
|
||||
@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) {
|
||||
|
||||
Buff.prolong( defender, Blindness.class, Random.Float( 1, 1.5f + level ) );
|
||||
defender.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return YELLOW;
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@ public class Eldritch extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
// lvl 0 - 20%
|
||||
// lvl 1 - 33%
|
||||
// lvl 2 - 43%
|
||||
|
@ -48,11 +48,10 @@ public class Eldritch extends Weapon.Enchantment {
|
|||
} else {
|
||||
Buff.affect( defender, Terror.class, Terror.DURATION ).object = attacker.id();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,13 +34,17 @@ public class Grim extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
// lvl 0 - 8%
|
||||
// lvl 1 ~ 9%
|
||||
// lvl 2 ~ 10%
|
||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
|
||||
int level = Math.max( 0, weapon.level() );
|
||||
|
||||
//half of the attack damage is removed from enemy hp for the purpose of calculating proc chance
|
||||
int enemyHealth = defender.HP - (Math.max(defender.HP/2, damage));
|
||||
|
||||
//scales from 0 - 20% based on how low hp the enemy is, plus 1% per level
|
||||
int chance = Math.round(((defender.HT - enemyHealth) / (float)defender.HT)*20 + level);
|
||||
|
||||
if (Random.Int( level + 100 ) >= 92) {
|
||||
if (Random.Int( 100 ) < chance) {
|
||||
|
||||
defender.damage( defender.HP, this );
|
||||
defender.sprite.emitter().burst( ShadowParticle.UP, 5 );
|
||||
|
@ -49,13 +53,9 @@ public class Grim extends Weapon.Enchantment {
|
|||
Badges.validateGrimWeapon();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,25 +24,20 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
|||
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 Lucky extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x00FF00 );
|
||||
|
||||
@Override
|
||||
public boolean 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 dmg = damage;
|
||||
for (int i=1; i <= level+1; i++) {
|
||||
dmg = Math.max( dmg, attacker.damageRoll() - i );
|
||||
}
|
||||
|
||||
if (dmg > damage) {
|
||||
defender.damage( dmg - damage, this );
|
||||
return true;
|
||||
|
||||
if (Random.Int(100) < (50 + level)){
|
||||
return weapon.max();
|
||||
} else {
|
||||
return false;
|
||||
return weapon.min();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2016 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.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
|
||||
public class Projecting extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x888888 );
|
||||
|
||||
@Override
|
||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||
//Does nothing as a proc, instead increases weapon range.
|
||||
//See weapon.reachFactor, and MissileWeapon.throwPos;
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return GREY;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -34,31 +35,35 @@ import java.util.HashSet;
|
|||
|
||||
public class Shocking extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF, 0.5f );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
// lvl 0 - 25%
|
||||
// lvl 1 - 40%
|
||||
// lvl 2 - 50%
|
||||
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 + 4 ) >= 3) {
|
||||
if (Random.Int( level + 3 ) >= 2) {
|
||||
|
||||
affected.clear();
|
||||
affected.add(attacker);
|
||||
|
||||
arcs.clear();
|
||||
arcs.add(new Lightning.Arc(attacker.pos, defender.pos));
|
||||
hit(defender, Random.Int(1, damage / 2));
|
||||
hit(defender, Random.Int(1, damage / 3));
|
||||
|
||||
attacker.sprite.parent.add( new Lightning( arcs, null ) );
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return WHITE;
|
||||
}
|
||||
|
||||
private ArrayList<Char> affected = new ArrayList<>();
|
||||
|
|
|
@ -22,6 +22,8 @@ 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.Paralysis;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
|
@ -32,7 +34,7 @@ public class Stunning extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xCCAA44 );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
// lvl 0 - 13%
|
||||
// lvl 1 - 22%
|
||||
// lvl 2 - 30%
|
||||
|
@ -40,13 +42,12 @@ public class Stunning extends Weapon.Enchantment {
|
|||
|
||||
if (Random.Int( level + 8 ) >= 7) {
|
||||
|
||||
Buff.prolong( defender, com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis.class,
|
||||
Random.Float( 1, 1.5f + level ) );
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
Buff.prolong( defender, Paralysis.class, Random.Float( 1, 1.5f + level ) );
|
||||
defender.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 12 );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,11 +22,19 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
|
||||
public class Unstable extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
|
||||
|
||||
@Override
|
||||
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
return random().proc( weapon, attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return WHITE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@ public class Vampiric extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0x660022 );
|
||||
|
||||
@Override
|
||||
public boolean 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() );
|
||||
|
||||
// lvl 0 - 33%
|
||||
// lvl 1 - 43%
|
||||
// lvl 2 - 50%
|
||||
int maxValue = damage * (level + 2) / (level + 6);
|
||||
// lvl 0 - 20%
|
||||
// lvl 1 - 21.5%
|
||||
// lvl 2 - 23%
|
||||
int maxValue = Math.round(damage * ((level + 10) / (float)(level + 50)));
|
||||
int effValue = Math.min( Random.IntRange( 0, maxValue ), attacker.HT - attacker.HP );
|
||||
|
||||
if (effValue > 0) {
|
||||
|
@ -49,11 +49,9 @@ public class Vampiric extends Weapon.Enchantment {
|
|||
attacker.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
|
||||
attacker.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( effValue ) );
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ 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.Poison;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
|
@ -32,7 +33,7 @@ public class Venomous extends Weapon.Enchantment {
|
|||
private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x4400AA );
|
||||
|
||||
@Override
|
||||
public boolean 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%
|
||||
|
@ -40,13 +41,11 @@ public class Venomous extends Weapon.Enchantment {
|
|||
|
||||
if (Random.Int( level + 3 ) >= 2) {
|
||||
|
||||
Buff.affect( defender, com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison.class ).
|
||||
set( com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison.durationFactor( defender ) * (level + 1) );
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
Buff.affect( defender, Poison.class ).extend( Poison.durationFactor( defender ) * ((level/2) + 1) );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2016 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.Bleeding;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Vorpal extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0xAA6666 );
|
||||
|
||||
@Override
|
||||
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/4);
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemSprite.Glowing glowing() {
|
||||
return RED;
|
||||
}
|
||||
|
||||
}
|
|
@ -127,13 +127,13 @@ public class MagesStaff extends MeleeWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc(Char attacker, Char defender, int damage) {
|
||||
public int proc(Char attacker, Char defender, int damage) {
|
||||
if (wand != null && Dungeon.hero.subClass == HeroSubClass.BATTLEMAGE) {
|
||||
if (wand.curCharges < wand.maxCharges) wand.partialCharge += 0.33f;
|
||||
ScrollOfRecharging.charge((Hero)attacker);
|
||||
wand.onHit(this, attacker, defender, damage);
|
||||
}
|
||||
super.proc(attacker, defender, damage);
|
||||
return super.proc(attacker, defender, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,11 +93,11 @@ public class Boomerang extends MissileWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
super.proc( attacker, defender, damage );
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
if (attacker instanceof Hero && ((Hero)attacker).rangedWeapon == this) {
|
||||
circleBack( defender.pos, (Hero)attacker );
|
||||
}
|
||||
return super.proc( attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,9 +60,9 @@ public class CurareDart extends MissileWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
Buff.prolong( defender, Paralysis.class, DURATION );
|
||||
super.proc( attacker, defender, damage );
|
||||
return super.proc( attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -72,9 +72,9 @@ public class IncendiaryDart extends MissileWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
Buff.affect( defender, Burning.class ).reignite( defender );
|
||||
super.proc( attacker, defender, damage );
|
||||
return super.proc( attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,9 +58,9 @@ public class Javelin extends MissileWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
super.proc( attacker, defender, damage );
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
Buff.prolong( defender, Cripple.class, Cripple.DURATION );
|
||||
return super.proc( attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -52,6 +54,19 @@ abstract public class MissileWeapon extends Weapon {
|
|||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int throwPos(Hero user, int dst) {
|
||||
int defaultPos = super.throwPos(user, dst);
|
||||
if (defaultPos == dst) return dst;
|
||||
else if (enchantment instanceof Projecting){
|
||||
Ballistica ProjectingTrajectory = new Ballistica( user.pos, dst, Ballistica.STOP_TARGET );
|
||||
if (ProjectingTrajectory.dist <= 4) return ProjectingTrajectory.collisionPos;
|
||||
else return super.throwPos(user, dst);
|
||||
} else {
|
||||
return super.throwPos(user, dst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onThrow( int cell ) {
|
||||
Char enemy = Actor.findChar( cell );
|
||||
|
@ -95,9 +110,7 @@ abstract public class MissileWeapon extends Weapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
|
||||
super.proc( attacker, defender, damage );
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
|
||||
Hero hero = (Hero)attacker;
|
||||
if (hero.rangedWeapon == null && stackable) {
|
||||
|
@ -107,6 +120,9 @@ abstract public class MissileWeapon extends Weapon {
|
|||
detach( null );
|
||||
}
|
||||
}
|
||||
|
||||
return super.proc( attacker, defender, damage );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,9 +59,9 @@ public class Tamahawk extends MissileWeapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void proc( Char attacker, Char defender, int damage ) {
|
||||
super.proc( attacker, defender, damage );
|
||||
public int proc( Char attacker, Char defender, int damage ) {
|
||||
Buff.affect( defender, Bleeding.class ).set( damage );
|
||||
return super.proc( attacker, defender, damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -663,10 +663,16 @@ items.weapon.enchantments.blazing.name=blazing %s
|
|||
|
||||
items.weapon.enchantments.chilling.name=chilling %s
|
||||
|
||||
items.weapon.enchantments.dazzling.name=dazzling %s
|
||||
|
||||
items.weapon.enchantments.eldritch.name=eldritch %s
|
||||
|
||||
items.weapon.enchantments.grim.name=grim %s
|
||||
|
||||
items.weapon.enchantments.lucky.name=lucky %s
|
||||
|
||||
items.weapon.enchantments.projecting.name=projecting %s
|
||||
|
||||
items.weapon.enchantments.shocking.name=shocking %s
|
||||
|
||||
items.weapon.enchantments.stunning.name=stunning %s
|
||||
|
@ -677,7 +683,7 @@ items.weapon.enchantments.vampiric.name=vampiric %s
|
|||
|
||||
items.weapon.enchantments.venomous.name=venomous %s
|
||||
|
||||
items.weapon.enchantments.grim.name=grim %s
|
||||
items.weapon.enchantments.vorpal.name=vorpal %s
|
||||
|
||||
|
||||
###melee weapons
|
||||
|
|
|
@ -261,8 +261,6 @@ public class ItemSprite extends MovieClip {
|
|||
|
||||
public static class Glowing {
|
||||
|
||||
public static final Glowing WHITE = new Glowing( 0xFFFFFF, 0.6f );
|
||||
|
||||
public int color;
|
||||
public float red;
|
||||
public float green;
|
||||
|
|
Loading…
Reference in New Issue
Block a user