v0.7.3: removed two enchants, replaced them with two new ones!

This commit is contained in:
Evan Debenham 2019-05-14 18:10:27 -04:00
parent f08a064812
commit 1434e36725
11 changed files with 146 additions and 173 deletions

View File

@ -139,8 +139,16 @@ public class ShatteredPixelDungeon extends Game {
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.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vorpal" );
//v0.7.3
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift" );
}
@Override

View File

@ -96,9 +96,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
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.Swift;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
@ -327,18 +324,6 @@ public class Hero extends Char {
public int attackSkill( Char target ) {
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 );
if (((Weapon) wep).hasEnchant(Unstable.class, this)){
Unstable.justRolledPrecise = true;
}
return Integer.MAX_VALUE;
}
}
float accuracy = 1;
accuracy *= RingOfAccuracy.accuracyMultiplier( this );
@ -470,12 +455,6 @@ public class Hero extends Char {
}
public float attackDelay() {
if (buff(Swift.SwiftAttack.class) != null
&& buff(Swift.SwiftAttack.class).boostsMelee()) {
buff(Swift.SwiftAttack.class).detach();
return 0;
}
if (belongings.weapon != null) {
return belongings.weapon.speedFactor( this );

View File

@ -23,13 +23,10 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment;
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.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -92,16 +89,6 @@ public class Statue extends Mob {
@Override
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));
}

View File

@ -43,8 +43,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
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.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@ -497,18 +495,6 @@ public class DriedRose extends Artifact {
@Override
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.
int acc = Dungeon.hero.lvl + 9;

View File

@ -42,13 +42,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazin
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.Kinetic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Corrupting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Elastic;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
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.Shocking;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -313,14 +313,14 @@ abstract public class Weapon extends KindOfWeapon {
public static abstract class Enchantment implements Bundlable {
private static final Class<?>[] common = new Class<?>[]{
Blazing.class, Chilling.class, Shocking.class, Blooming.class};
Blazing.class, Chilling.class, Kinetic.class, Shocking.class};
private static final Class<?>[] uncommon = new Class<?>[]{
Swift.class, Elastic.class, Projecting.class,
Unstable.class, Precise.class, Blocking.class};
Blocking.class, Blooming.class, Elastic.class,
Lucky.class, Projecting.class, Unstable.class};
private static final Class<?>[] rare = new Class<?>[]{
Grim.class, Vampiric.class, Lucky.class};
Corrupting.class, Grim.class, Vampiric.class};
private static final float[] typeChances = new float[]{
50, //12.5% each

View File

@ -0,0 +1,95 @@
/*
* 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.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Random;
public class Corrupting extends Weapon.Enchantment {
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x440066 );
@Override
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
if (defender.buff(Corruption.class) != null || !(defender instanceof Mob)) return damage;
int level = Math.max( 0, weapon.level() );
// lvl 0 - 10%
// lvl 1 ~ 12%
// lvl 2 ~ 14%
if (damage >= defender.HP
&& !defender.isImmune(Corruption.class)
&& Random.Int( level + 40 ) >= 36){
Mob enemy = (Mob) defender;
Hero hero = (attacker instanceof Hero) ? (Hero) attacker : Dungeon.hero;
enemy.HP = enemy.HT;
for (Buff buff : enemy.buffs()) {
if (buff.type == Buff.buffType.NEGATIVE
&& !(buff instanceof SoulMark)) {
buff.detach();
} else if (buff instanceof PinCushion){
buff.detach();
}
}
if (enemy.alignment == Char.Alignment.ENEMY){
enemy.rollToDropLoot();
}
Buff.affect(enemy, Corruption.class);
Statistics.enemiesSlain++;
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (enemy.EXP > 0 && hero.lvl <= enemy.maxLvl) {
hero.sprite.showStatus(CharSprite.POSITIVE, Messages.get(enemy, "exp", enemy.EXP));
hero.earnExp(enemy.EXP, enemy.getClass());
} else {
hero.earnExp(0, enemy.getClass());
}
return 0;
}
return damage;
}
@Override
public ItemSprite.Glowing glowing() {
return BLACK;
}
}

View File

@ -25,30 +25,30 @@ 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.items.weapon.melee.MeleeWeapon;
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 Swift extends Weapon.Enchantment {
public class Kinetic 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 - 13%
// lvl 1 - 22%
// lvl 2 - 30%
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 8 ) >= 7) {
Buff.prolong(attacker, SwiftAttack.class, 5).setSourceType(weapon instanceof MeleeWeapon);
int conservedDamage = 0;
if (attacker.buff(ConservedDamage.class) != null) {
conservedDamage = attacker.buff(ConservedDamage.class).damageBonus();
attacker.buff(ConservedDamage.class).detach();
}
return damage;
if (damage > defender.HP){
int extraDamage = damage - defender.HP;
Buff.affect(attacker, ConservedDamage.class, extraDamage*10);
}
return damage + conservedDamage;
}
@Override
@ -56,32 +56,13 @@ public class Swift extends Weapon.Enchantment {
return YELLOW;
}
public static class SwiftAttack extends FlavourBuff {
boolean sourceWasMelee;
public void setSourceType( boolean melee ){
this.sourceWasMelee = melee;
}
public boolean boostsMelee(){
return !sourceWasMelee;
}
public boolean boostsRanged(){
return sourceWasMelee;
}
public static class ConservedDamage extends FlavourBuff {
@Override
public int icon() {
return BuffIndicator.WEAPON;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(1, 1, 0);
}
@Override
public String toString() {
return Messages.get(this, "name");
@ -89,21 +70,12 @@ public class Swift extends Weapon.Enchantment {
@Override
public String desc() {
return Messages.get(this, sourceWasMelee ? "desc_melee" : "desc_ranged", dispTurns());
return Messages.get(this, "desc", damageBonus());
}
private static final String WAS_MELEE = "was_melee";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(WAS_MELEE, sourceWasMelee);
public int damageBonus(){
return (int)Math.ceil(cooldown()/10f);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
sourceWasMelee = bundle.getBoolean(WAS_MELEE);
}
}
}

View File

@ -1,56 +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.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Random;
public class Precise extends Weapon.Enchantment {
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
@Override
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 1 - 22%
// lvl 2 - 30%
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 8 ) >= 7) {
return true;
}
return false;
}
@Override
public ItemSprite.Glowing glowing() {
return WHITE;
}
}

View File

@ -36,31 +36,32 @@ public class Unstable extends Weapon.Enchantment {
Blocking.class,
Blooming.class,
Chilling.class,
Kinetic.class,
Corrupting.class,
Elastic.class,
Grim.class,
Lucky.class,
//precise also not included here, is manually checked in attackSkill
//projecting not included, no on-hit effect
Shocking.class,
Swift.class,
Vampiric.class
};
public static boolean justRolledPrecise;
@Override
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
if (justRolledPrecise){
justRolledPrecise = false;
return damage;
int conservedDamage = 0;
if (attacker.buff(Kinetic.ConservedDamage.class) != null) {
conservedDamage = attacker.buff(Kinetic.ConservedDamage.class).damageBonus();
attacker.buff(Kinetic.ConservedDamage.class).detach();
}
try {
return Random.oneOf(randomEnchants).newInstance().proc( weapon, attacker, defender, damage );
damage = Random.oneOf(randomEnchants).newInstance().proc( weapon, attacker, defender, damage );
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
return damage;
}
return damage + conservedDamage;
}
@Override

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
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.items.weapon.enchantments.Swift;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -195,12 +194,6 @@ abstract public class MissileWeapon extends Weapon {
@Override
public float castDelay(Char user, int dst) {
if (Actor.findChar( dst ) != null
&& user.buff(Swift.SwiftAttack.class) != null
&& user.buff(Swift.SwiftAttack.class).boostsRanged()) {
user.buff(Swift.SwiftAttack.class).detach();
return 0;
}
return speedFactor( user );
}

View File

@ -1170,6 +1170,14 @@ items.weapon.enchantments.blooming.desc=Blooming weapons contain magic which wil
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.kinetic.name=kinetic %s
items.weapon.enchantments.kinetic.desc=When an enemy is killed with a kinetic weapon, any excess force is stored in the weapon and will be applied to the next successful attack.
items.weapon.enchantments.kinetic$conserveddamage.name=Conserved Damage
items.weapon.enchantments.kinetic$conserveddamage.desc=Your weapon has stored the excess force from a previous killing blow, and will apply it as bonus damage to your next attack. The energy will slowly fade over time, however.\n\nConserved Damage: %d.
items.weapon.enchantments.corrupting.name=corrupting %s
items.weapon.enchantments.corrupting.desc=This powerful enchantment posses similar power to the wand of corruption. When an enemy is killed with a corrupting weapon, there is a chance they will become corrupted.
items.weapon.enchantments.elastic.name=elastic %s
items.weapon.enchantments.elastic.desc=Elastic weapons have a chance to send enemies flying back short distances.
@ -1177,7 +1185,7 @@ 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.lucky.name=lucky %s
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.lucky.desc=Enemies which are killed by 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.