v1.3.0: replaced fragile curse with explosive curse

This commit is contained in:
Evan Debenham
2022-05-23 13:57:55 -04:00
parent 3cb0cfe853
commit 28015c7282
6 changed files with 148 additions and 69 deletions
@@ -1358,8 +1358,13 @@ items.weapon.curses.displacing.desc=Displacing weapons are infused with chaotic
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.fragile.name=fragile %s
items.weapon.curses.fragile.desc=Fragile weapons start out just as strong as their normal counterparts, but rapidly decrease in effectiveness as they are used.
items.weapon.curses.explosive.name=explosive %s
items.weapon.curses.explosive.warm=Warm...
items.weapon.curses.explosive.hot=Hot!
items.weapon.curses.explosive.desc=Explosive weapons steadily build up power and explode, damaging the wearer and enemy.
items.weapon.curses.explosive.desc_cool=Your weapon is currently cool to the touch.
items.weapon.curses.explosive.desc_warm=Your weapon is building energy and getting warm...
items.weapon.curses.explosive.desc_hot=_Your weapon is hot! It's about to explode!_
items.weapon.curses.friendly.name=friendly %s
items.weapon.curses.friendly.desc=Friendly weapons are best suited for pacifists, occasionally triggering magic that makes it impossible to fight.
@@ -46,6 +46,11 @@ public class ShatteredPixelDungeon extends Game {
public ShatteredPixelDungeon( PlatformSupport platform ) {
super( sceneClass == null ? WelcomeScene.class : sceneClass, platform );
//v1.3.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Explosive.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile" );
//v1.2.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.CleansingDart.class,
@@ -34,7 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Annoying;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Explosive;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Friendly;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Polarized;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial;
@@ -353,7 +353,7 @@ abstract public class Weapon extends KindOfWeapon {
};
private static final Class<?>[] curses = new Class<?>[]{
Annoying.class, Displacing.class, Exhausting.class, Fragile.class,
Annoying.class, Displacing.class, Exhausting.class, Explosive.class,
Sacrificial.class, Wayward.class, Polarized.class, Friendly.class
};
@@ -0,0 +1,133 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2022 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.curses;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Explosive extends Weapon.Enchantment {
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
private static ItemSprite.Glowing WARM = new ItemSprite.Glowing( 0x000000, 0.5f );
private static ItemSprite.Glowing HOT = new ItemSprite.Glowing( 0x000000, 0.25f );
private int durability = 100;
@Override
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
//average value of 5, or 20 hits to an explosion
int durToReduce = Random.IntRange(0, 10);
int currentDurability = durability;
durability -= durToReduce;
if (currentDurability > 50 && durability <= 50){
attacker.sprite.showStatus(CharSprite.WARNING, Messages.get(this, "warm"));
GLog.w(Messages.get(this, "desc_warm"));
attacker.sprite.emitter().burst(SmokeParticle.FACTORY, 4);
Item.updateQuickslot();
} else if (currentDurability > 10 && durability <= 10){
attacker.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(this, "hot"));
GLog.n(Messages.get(this, "desc_hot"));
attacker.sprite.emitter().burst(BlastParticle.FACTORY, 5);
Item.updateQuickslot();
} else if (durability <= 0) {
//explosion position is either the attacker's position (when attacker and defender are adjacent)
//or the closest cell to the defender on a straight path to them otherwise
int explosionPos = -1;
if (Dungeon.level.adjacent(attacker.pos, defender.pos)){
explosionPos = attacker.pos;
} else {
Ballistica path = new Ballistica(attacker.pos, defender.pos, Ballistica.PROJECTILE);
if (path.dist == 0){
explosionPos = attacker.pos;
} else {
explosionPos = path.path.get(path.dist-1);
}
}
new Bomb().explode(explosionPos);
durability = 100;
Item.updateQuickslot();
}
return damage;
}
@Override
public boolean curse() {
return true;
}
@Override
public ItemSprite.Glowing glowing() {
if (durability > 50){
return BLACK;
} else if (durability > 10){
return WARM;
} else {
return HOT;
}
}
@Override
public String desc() {
String desc = super.desc();
if (durability > 50){
desc += " " + Messages.get(this, "desc_cool");
} else if (durability > 10){
desc += " " + Messages.get(this, "desc_warm");
} else {
desc += " " + Messages.get(this, "desc_hot");
}
return desc;
}
private static final String DURABILITY = "durability";
@Override
public void restoreFromBundle( Bundle bundle ) {
durability = bundle.getInt(DURABILITY);
//pre-1.3 saves
if (durability <= 0){
durability = 100;
}
}
@Override
public void storeInBundle( Bundle bundle ) {
bundle.put(DURABILITY, durability);
}
}
@@ -1,64 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2022 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.curses;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Bundle;
public class Fragile extends Weapon.Enchantment {
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
private int hits = 0;
@Override
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
//degrades from 100% to 25% damage over 150 hits
damage *= (1f - hits*0.005f);
if (hits < 150) hits++;
return damage;
}
@Override
public boolean curse() {
return true;
}
@Override
public ItemSprite.Glowing glowing() {
return BLACK;
}
private static final String HITS = "hits";
@Override
public void restoreFromBundle( Bundle bundle ) {
hits = bundle.getInt(HITS);
}
@Override
public void storeInBundle( Bundle bundle ) {
bundle.put(HITS, hits);
}
}
@@ -96,7 +96,7 @@ public class MeleeWeapon extends Weapon {
if (enchantment != null && (cursedKnown || !enchantment.curse())){
info += "\n\n" + Messages.get(Weapon.class, "enchanted", enchantment.name());
info += " " + Messages.get(enchantment, "desc");
info += " " + enchantment.desc();
}
if (cursed && isEquipped( Dungeon.hero )) {