v3.0.0: Implemented base artifact functionality for holy tome
This commit is contained in:
@@ -342,7 +342,9 @@ items.artifacts.etherealchains$chainsrecharge.levelup=Your chains grow stronger!
|
|||||||
|
|
||||||
items.artifacts.holytome.name=holy tome
|
items.artifacts.holytome.name=holy tome
|
||||||
items.artifacts.holytome.ac_cast=CAST
|
items.artifacts.holytome.ac_cast=CAST
|
||||||
items.artifacts.holytome.desc=TODO
|
items.artifacts.holytome.no_charge=Your tome is out of charge. Gain exp to recharge it.
|
||||||
|
items.artifacts.holytome.levelup=Your tome grows stronger!
|
||||||
|
items.artifacts.holytome.desc=A holy tome that acts as a focus for the Cleric's divine magic. Using the tome lets the Cleric cast a variety of magical spells.\n\nThe tome will steadily get more powerful as the Cleric uses it, and it will recharge as the Cleric gains experience points when defeating enemies.
|
||||||
|
|
||||||
items.artifacts.hornofplenty.name=horn of plenty
|
items.artifacts.hornofplenty.name=horn of plenty
|
||||||
items.artifacts.hornofplenty.ac_snack=SNACK
|
items.artifacts.hornofplenty.ac_snack=SNACK
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ 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.SacrificialFire;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SacrificialFire;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HeroDisguise;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invulnerability;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
|
||||||
@@ -50,9 +48,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Foresight;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Foresight;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GreaterHaste;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GreaterHaste;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HeroDisguise;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HoldFast;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HoldFast;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invulnerability;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
|
||||||
@@ -97,6 +97,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
||||||
@@ -1886,7 +1887,10 @@ public class Hero extends Char {
|
|||||||
|
|
||||||
MasterThievesArmband.Thievery armband = buff(MasterThievesArmband.Thievery.class);
|
MasterThievesArmband.Thievery armband = buff(MasterThievesArmband.Thievery.class);
|
||||||
if (armband != null) armband.gainCharge(percent);
|
if (armband != null) armband.gainCharge(percent);
|
||||||
|
|
||||||
|
HolyTome.TomeRecharge tome = buff(HolyTome.TomeRecharge.class);
|
||||||
|
if (tome != null) tome.gainCharge(percent);
|
||||||
|
|
||||||
Berserk berserk = buff(Berserk.class);
|
Berserk berserk = buff(Berserk.class);
|
||||||
if (berserk != null) berserk.recover(percent);
|
if (berserk != null) berserk.recover(percent);
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,15 @@
|
|||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -59,21 +65,95 @@ public class HolyTome extends Artifact {
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
//levelling:
|
@Override
|
||||||
//starts with 3 charges at +0, reaches 10 charges at +7. +8,9,10 slightly increases charge speed
|
public void execute( Hero hero, String action ) {
|
||||||
//levels up based on use, probably with a very similar target level system to the Cloak
|
|
||||||
|
|
||||||
//how does the UI for actually using it work though?
|
super.execute(hero, action);
|
||||||
|
|
||||||
|
if (hero.buff(MagicImmune.class) != null) return;
|
||||||
|
|
||||||
|
if (action.equals(AC_CAST)) {
|
||||||
|
|
||||||
|
if (!isEquipped(hero)) GLog.i(Messages.get(Artifact.class, "need_to_equip"));
|
||||||
|
else if (charge == 0) GLog.i(Messages.get(this, "no_charge"));
|
||||||
|
else {
|
||||||
|
|
||||||
|
//TODO cast an actual spell!
|
||||||
|
charge--;
|
||||||
|
gainExp( 1 );
|
||||||
|
updateQuickslot();
|
||||||
|
|
||||||
|
hero.spend( 1f );
|
||||||
|
hero.busy();
|
||||||
|
hero.sprite.operate(hero.pos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gainExp( float chargesSpent ){
|
||||||
|
//target hero level is 1 + 2*tome level
|
||||||
|
int lvlDiffFromTarget = Dungeon.hero.lvl - (1+level()*2);
|
||||||
|
//plus an extra one for each level after 6
|
||||||
|
if (level() >= 7){
|
||||||
|
lvlDiffFromTarget -= level()-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lvlDiffFromTarget >= 0){
|
||||||
|
exp += Math.round(chargesSpent * 10f * Math.pow(1.1f, lvlDiffFromTarget));
|
||||||
|
} else {
|
||||||
|
exp += Math.round(chargesSpent * 10f * Math.pow(0.75f, -lvlDiffFromTarget));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exp >= (level() + 1) * 50 && level() < levelCap) {
|
||||||
|
upgrade();
|
||||||
|
Catalog.countUse(HolyTome.class);
|
||||||
|
exp -= level() * 50;
|
||||||
|
GLog.p(Messages.get(this, "levelup"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item upgrade() {
|
||||||
|
chargeCap = Math.min(chargeCap + 1, 10);
|
||||||
|
return super.upgrade();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ArtifactBuff passiveBuff() {
|
protected ArtifactBuff passiveBuff() {
|
||||||
return new tomeRecharge();
|
return new TomeRecharge();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class tomeRecharge extends ArtifactBuff{
|
public class TomeRecharge extends ArtifactBuff {
|
||||||
|
|
||||||
public void gainCharge(float levelPortion) {
|
public void gainCharge(float levelPortion) {
|
||||||
//TODO
|
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||||
|
|
||||||
|
if (charge < chargeCap) {
|
||||||
|
|
||||||
|
//gains 2.5 charges per hero level, plus 10% per missing charge, plus another 10% for every level after 7
|
||||||
|
float chargeGain = (2.5f * levelPortion) * (1f+(chargeCap - charge)/10f);
|
||||||
|
if (level() > 7) chargeGain *= 1f + (level()-7)/10f;
|
||||||
|
|
||||||
|
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||||
|
|
||||||
|
partialCharge += chargeGain;
|
||||||
|
|
||||||
|
//charge is in increments of 1/5 max hunger value.
|
||||||
|
while (partialCharge >= 1) {
|
||||||
|
charge++;
|
||||||
|
partialCharge -= 1;
|
||||||
|
|
||||||
|
if (charge == chargeCap){
|
||||||
|
partialCharge = 0;
|
||||||
|
}
|
||||||
|
updateQuickslot();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
partialCharge = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user