From 229e0522ade78d8d65ce819a7e0238c0134e3ffd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 22 Jul 2018 17:42:20 -0400 Subject: [PATCH] v0.7.0: some exotic scroll implementation and polish (more still needed) --- .../actors/buffs/ArtifactRecharge.java | 25 ++++++ .../items/scrolls/Scroll.java | 4 +- .../items/scrolls/exotic/ExoticScroll.java | 14 ++-- .../scrolls/exotic/ScrollOfAffection.java | 2 +- .../scrolls/exotic/ScrollOfForesight.java | 78 +++++++++++-------- .../exotic/ScrollOfMysticalEnergy.java | 52 +++++++++++++ .../scrolls/exotic/ScrollOfPetrification.java | 1 - .../messages/items/items.properties | 42 ++++++++++ 8 files changed, 177 insertions(+), 41 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java new file mode 100644 index 000000000..a8a4e5ab6 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java @@ -0,0 +1,25 @@ +/* + * 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 + */ + +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +public class ArtifactRecharge extends Buff { +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index 48df52b09..cd68cfeb9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -96,7 +96,7 @@ public abstract class Scroll extends Item { protected static ItemStatusHandler handler; - private String rune; + protected String rune; public boolean ownedByBook = false; @@ -204,7 +204,7 @@ public abstract class Scroll extends Item { @Override public String name() { - return isKnown() ? name : Messages.get(Scroll.class, rune); + return isKnown() ? name : Messages.get(this, rune); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java index db0a03305..2f0c987a9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; @@ -68,17 +69,17 @@ public abstract class ExoticScroll extends Scroll { regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class); exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class); - regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class); - exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class); + regToExo.put(ScrollOfTransmutation.class, ScrollOfDistortion.class); + exoToReg.put(ScrollOfDistortion.class, ScrollOfTransmutation.class); + + regToExo.put(ScrollOfRecharging.class, ScrollOfMysticalEnergy.class); + exoToReg.put(ScrollOfMysticalEnergy.class, ScrollOfRecharging.class); //TODO regToExo.put(ScrollOfTeleportation.class, ScrollOfPetrification.class); exoToReg.put(ScrollOfPetrification.class, ScrollOfTeleportation.class); - regToExo.put(ScrollOfRecharging.class, ScrollOfPetrification.class); - exoToReg.put(ScrollOfPetrification.class, ScrollOfRecharging.class); - regToExo.put(ScrollOfMagicMapping.class, ScrollOfPetrification.class); exoToReg.put(ScrollOfPetrification.class, ScrollOfMagicMapping.class); @@ -96,7 +97,7 @@ public abstract class ExoticScroll extends Scroll { @Override public void setKnown() { - if (!isKnown()) { + if (!ownedByBook && !isKnown()) { handler.know(exoToReg.get(this.getClass())); updateQuickslot(); } @@ -107,6 +108,7 @@ public abstract class ExoticScroll extends Scroll { super.reset(); if (handler != null && handler.contains(exoToReg.get(this.getClass()))) { image = handler.image(exoToReg.get(this.getClass())) + 16; + rune = handler.label(exoToReg.get(this.getClass())); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java index 82b858fcd..b36b267ec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java @@ -45,7 +45,7 @@ public class ScrollOfAffection extends ExoticScroll { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { if (Dungeon.level.heroFOV[mob.pos]) { - Buff.affect( mob, Charm.class, 20f ); + Buff.affect( mob, Charm.class, 20f ).object = curUser.id(); mob.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfForesight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfForesight.java index 215e342ab..460368042 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfForesight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfForesight.java @@ -25,13 +25,22 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.effects.Identification; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline; +import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Random; +import java.util.ArrayList; import java.util.HashSet; public class ScrollOfForesight extends ExoticScroll { @@ -58,37 +67,11 @@ public class ScrollOfForesight extends ExoticScroll { int total = potions.size() + scrolls.size() + rings.size(); if (total == 0){ - GLog.n("Nothing left to Identify!"); + GLog.n( Messages.get(this, "nothing_left") ); return; } - /* - //items which the player holds have lower priority - HashSet> heldPotions = new HashSet<>(); - HashSet> heldScrolls = new HashSet<>(); - HashSet> heldRings = new HashSet<>(); - - for (Class p : potions){ - if (curUser.belongings.getItem(p) != null){ - heldPotions.add(p); - } - } - potions.removeAll(heldPotions); - - for (Class s : scrolls){ - if (curUser.belongings.getItem(s) != null){ - heldScrolls.add(s); - } - } - scrolls.removeAll(heldScrolls); - - for (Class r : rings){ - if (curUser.belongings.getItem(r) != null){ - heldRings.add(r); - } - } - rings.removeAll(heldRings);*/ - + ArrayList IDed = new ArrayList<>(); int left = 4; while (left > 0 && total > 0) { @@ -99,21 +82,21 @@ public class ScrollOfForesight extends ExoticScroll { if (potions.isEmpty()) continue; Potion p = Random.element(potions).newInstance(); p.setKnown(); - GLog.i(p.name() + " identified!"); + IDed.add(p); potions.remove(p.getClass()); break; case 1: if (scrolls.isEmpty()) continue; Scroll s = Random.element(scrolls).newInstance(); s.setKnown(); - GLog.i(s.name() + " identified!"); + IDed.add(s); scrolls.remove(s.getClass()); break; case 2: if (rings.isEmpty()) continue; Ring r = Random.element(rings).newInstance(); r.setKnown(); - GLog.i(r.name() + " identified!"); + IDed.add(r); rings.remove(r.getClass()); break; } @@ -123,5 +106,38 @@ public class ScrollOfForesight extends ExoticScroll { left --; total --; } + + GameScene.show(new WndForesight( IDed )); + } + + private class WndForesight extends Window { + + private static final int WIDTH = 120; + + WndForesight(ArrayList IDed ){ + IconTitle cur = new IconTitle(new ItemSprite(ScrollOfForesight.this), + Messages.titleCase(Messages.get(ScrollOfForesight.class, "name"))); + cur.setRect(0, 0, WIDTH, 0); + add(cur); + + RenderedTextMultiline msg = PixelScene.renderMultiline(Messages.get(this, "desc"), 6); + msg.maxWidth(120); + msg.setPos(0, cur.bottom() + 2); + add(msg); + + float pos = msg.bottom() + 10; + + for (Item i : IDed){ + + cur = new IconTitle(i); + cur.setRect(0, pos, WIDTH, 0); + add(cur); + pos = cur.bottom() + 2; + + } + + resize(WIDTH, (int)pos); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java new file mode 100644 index 000000000..3b61c3539 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java @@ -0,0 +1,52 @@ +/* + * 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 + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; +import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; +import com.watabou.noosa.audio.Sample; + +public class ScrollOfMysticalEnergy extends ExoticScroll { + + { + initials = 6; + } + + @Override + public void doRead() { + + //append buff + ScrollOfRecharging.charge(curUser); + + Sample.INSTANCE.play( Assets.SND_READ ); + Invisibility.dispel(); + + SpellSprite.show( curUser, SpellSprite.CHARGE ); + setKnown(); + ScrollOfRecharging.charge(curUser); + + readAnimation(); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPetrification.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPetrification.java index 22e285a38..ea69e63c2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPetrification.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPetrification.java @@ -45,7 +45,6 @@ public class ScrollOfPetrification extends ExoticScroll { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { if (Dungeon.level.heroFOV[mob.pos]) { Buff.affect( mob, Paralysis.class, Paralysis.DURATION ); - } } diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 4d69f2174..4f1e7681f 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -767,6 +767,48 @@ items.scrolls.scrollofupgrade.remove_curse=The scroll of upgrade cleanses the cu items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, improving its quality. A wand will increase in power and number of charges, weapons and armor will deal and block more damage, and the effects of rings will intensify. This scroll is even able to mitigate or sometimes totally dispel curse effects, though it is not as potent as a scroll of remove curse. +###exotic scrolls +items.scrolls.exotic.exoticscroll.kaunan=exotic scroll of KAUNAN +items.scrolls.exotic.exoticscroll.sowilo=exotic scroll of SOWILO +items.scrolls.exotic.exoticscroll.laguz=exotic scroll of LAGUZ +items.scrolls.exotic.exoticscroll.yngvi=exotic scroll of YNGVI +items.scrolls.exotic.exoticscroll.gyfu=exotic scroll of GYFU +items.scrolls.exotic.exoticscroll.raido=exotic scroll of RAIDO +items.scrolls.exotic.exoticscroll.isaz=exotic scroll of ISAZ +items.scrolls.exotic.exoticscroll.mannaz=exotic scroll of MANNAZ +items.scrolls.exotic.exoticscroll.naudiz=exotic scroll of NAUDIZ +items.scrolls.exotic.exoticscroll.berkanan=exotic scroll of BERKANAN +items.scrolls.exotic.exoticscroll.odal=exotic scroll of ODAL +items.scrolls.exotic.exoticscroll.tiwaz=exotic scroll of TIWAZ +items.scrolls.exotic.exoticscroll.unknown_desc=A glowing indecipherable magical rune is written on this black parchment. It seems to be foreign to this land, who knows what it will do when read aloud? + +items.scrolls.exotic.scrollofaffection.name=scroll of affection +items.scrolls.exotic.scrollofaffection.desc=Reading this scroll will emit an alluring laugh which charms all who hear it. + +items.scrolls.exotic.scrollofantimagic.name=scroll of anti-magic +items.scrolls.exotic.scrollofantimagic.desc=The incantation on this scroll will surround you with a magical aura that temporarily blocks all magical effects, harmful or helpful. + +items.scrolls.exotic.scrollofconfusion.name=scroll of confusion +items.scrolls.exotic.scrollofconfusion.desc=When read aloud, this scroll will unleash confusing magic on all targets in sight, blinding and disorienting them. + +items.scrolls.exotic.scrollofdistortion.name=scroll of distortion +items.scrolls.exotic.scrollofdistortion.desc=This scroll contains powerful magic capable of warping reality. + +items.scrolls.exotic.scrollofenchantment.name=scroll of enchantment +items.scrolls.exotic.scrollofenchantment.inv_title=enchant an item +items.scrolls.exotic.scrollofenchantment.desc= + +items.scrolls.exotic.scrollofforesight.name=scroll of foresight +items.scrolls.exotic.scrollofforesight.nothing_left=There is nothing left to identify! +items.scrolls.exotic.scrollofforesight.desc=This scroll will permanently identify the type of four random items. The items identified won't necessary be ones you're carrying. +items.scrolls.exotic.scrollofforesight$wndforesight.desc=Your scroll of foresight has identified the following items: + +items.scrolls.exotic.scrollofmysticalenergy.name=scroll of mystical energy +items.scrolls.exotic.scrollofmysticalenergy.desc= + +items.scrolls.exotic.scrollofpetrification.name=scroll of petrification +items.scrolls.exotic.scrollofpetrification.desc=A flash of red light will overwhelm all creatures in your field of view with such great terror that they will be frozen on the spot. + ###runestones items.stones.inventorystone.ac_use=USE