v0.3.5: added some basic tutorial stuff for the mage and warrior's items
This commit is contained in:
parent
b4d78ada9d
commit
83711cc836
|
@ -20,6 +20,28 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Acidic;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Albino;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bandit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Senior;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shielded;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
|
||||
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.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Callback;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -29,29 +51,6 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Acidic;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Albino;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bandit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Senior;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shielded;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
|
||||
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.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Callback;
|
||||
|
||||
public class Badges {
|
||||
|
||||
public enum Badge {
|
||||
|
@ -126,6 +125,8 @@ public class Badges {
|
|||
RARE_SENIOR,
|
||||
RARE_ACIDIC,
|
||||
RARE( 37, true ),
|
||||
TUTORIAL_WARRIOR,
|
||||
TUTORIAL_MAGE,
|
||||
VICTORY_WARRIOR,
|
||||
VICTORY_MAGE,
|
||||
VICTORY_ROGUE,
|
||||
|
@ -165,7 +166,7 @@ public class Badges {
|
|||
public String desc(){
|
||||
return Messages.get(this, name());
|
||||
}
|
||||
|
||||
|
||||
Badge() {
|
||||
this( -1 );
|
||||
}
|
||||
|
@ -188,6 +189,7 @@ public class Badges {
|
|||
|
||||
private static HashSet<Badge> restore( Bundle bundle ) {
|
||||
HashSet<Badge> badges = new HashSet<Badge>();
|
||||
if (bundle == null) return badges;
|
||||
|
||||
String[] names = bundle.getStringArray( BADGES );
|
||||
for (int i=0; i < names.length; i++) {
|
||||
|
@ -803,7 +805,29 @@ public class Badges {
|
|||
displayBadge( badge );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void validateTutorial(){
|
||||
Badge badge = null;
|
||||
switch (Dungeon.hero.heroClass){
|
||||
case WARRIOR:
|
||||
badge = Badge.TUTORIAL_WARRIOR;
|
||||
break;
|
||||
case MAGE:
|
||||
badge = Badge.TUTORIAL_MAGE;
|
||||
break;
|
||||
case ROGUE:
|
||||
break;
|
||||
case HUNTRESS:
|
||||
break;
|
||||
}
|
||||
|
||||
local.add( badge );
|
||||
if (!global.contains( badge )) {
|
||||
global.add( badge );
|
||||
saveNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateNoKilling() {
|
||||
if (!local.contains( Badge.NO_MONSTERS_SLAIN ) && Statistics.completedWithNoKilling) {
|
||||
Badge badge = Badge.NO_MONSTERS_SLAIN;
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||
|
@ -109,15 +108,29 @@ public enum HeroClass {
|
|||
Dart darts = new Dart( 8 );
|
||||
darts.identify().collect();
|
||||
|
||||
hero.belongings.armor.affixSeal(new BrokenSeal());
|
||||
|
||||
Dungeon.quickslot.setSlot(0, darts);
|
||||
if ( Badges.global.contains(Badges.Badge.TUTORIAL_WARRIOR) ){
|
||||
hero.belongings.armor.affixSeal(new BrokenSeal());
|
||||
Dungeon.quickslot.setSlot(0, darts);
|
||||
} else {
|
||||
BrokenSeal seal = new BrokenSeal();
|
||||
seal.collect();
|
||||
Dungeon.quickslot.setSlot(0, seal);
|
||||
Dungeon.quickslot.setSlot(1, darts);
|
||||
}
|
||||
|
||||
new PotionOfHealing().setKnown();
|
||||
}
|
||||
|
||||
private static void initMage( Hero hero ) {
|
||||
MagesStaff staff = new MagesStaff(new WandOfMagicMissile());
|
||||
MagesStaff staff;
|
||||
|
||||
if ( Badges.global.contains(Badges.Badge.TUTORIAL_MAGE) ){
|
||||
staff = new MagesStaff(new WandOfMagicMissile());
|
||||
} else {
|
||||
staff = new MagesStaff();
|
||||
new WandOfMagicMissile().identify().collect();
|
||||
}
|
||||
|
||||
(hero.belongings.weapon = staff).identify();
|
||||
hero.belongings.weapon.activate(hero);
|
||||
|
||||
|
@ -137,8 +150,7 @@ public enum HeroClass {
|
|||
darts.identify().collect();
|
||||
|
||||
Dungeon.quickslot.setSlot(0, cloak);
|
||||
if (ShatteredPixelDungeon.quickSlots() > 1)
|
||||
Dungeon.quickslot.setSlot(1, darts);
|
||||
Dungeon.quickslot.setSlot(1, darts);
|
||||
|
||||
new ScrollOfMagicMapping().setKnown();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
|
@ -10,6 +11,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndItem;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,12 +20,17 @@ public class BrokenSeal extends Item {
|
|||
|
||||
public static final String AC_AFFIX = "AFFIX";
|
||||
|
||||
//only to be used from the quickslot, for tutorial purposes mostly.
|
||||
public static final String AC_INFO = "INFO_WINDOW";
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.SIGIL;
|
||||
|
||||
cursedKnown = levelKnown = true;
|
||||
unique = true;
|
||||
bones = false;
|
||||
|
||||
defaultAction = AC_INFO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,6 +45,8 @@ public class BrokenSeal extends Item {
|
|||
if (action.equals(AC_AFFIX)){
|
||||
curItem = this;
|
||||
GameScene.selectItem(armorSelector, WndBag.Mode.ARMOR, Messages.get(this, "prompt"));
|
||||
} else if (action.equals(AC_INFO)) {
|
||||
GameScene.show(new WndItem(null, this, true));
|
||||
} else {
|
||||
super.execute(hero, action);
|
||||
}
|
||||
|
@ -63,6 +72,7 @@ public class BrokenSeal extends Item {
|
|||
Sample.INSTANCE.play(Assets.SND_UNLOCK);
|
||||
armor.affixSeal((BrokenSeal)curItem);
|
||||
curItem.detach(Dungeon.hero.belongings.backpack);
|
||||
Badges.validateTutorial();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
|
@ -38,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndItem;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.particles.Emitter;
|
||||
|
@ -111,8 +113,11 @@ public class MagesStaff extends MeleeWeapon {
|
|||
GameScene.selectItem(itemSelector, WndBag.Mode.WAND, Messages.get(this, "prompt"));
|
||||
|
||||
} else if (action.equals(AC_ZAP)){
|
||||
if (wand == null)
|
||||
|
||||
if (wand == null) {
|
||||
GameScene.show(new WndItem(null, this, true));
|
||||
return;
|
||||
}
|
||||
|
||||
wand.execute(hero, AC_ZAP);
|
||||
} else
|
||||
|
@ -230,7 +235,13 @@ public class MagesStaff extends MeleeWeapon {
|
|||
|
||||
@Override
|
||||
public String info() {
|
||||
return super.info();
|
||||
String info = super.info();
|
||||
|
||||
if (wand == null){
|
||||
info += "\n\n" + Messages.get(this, "no_wand");
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -274,33 +285,40 @@ public class MagesStaff extends MeleeWeapon {
|
|||
return;
|
||||
}
|
||||
|
||||
GameScene.show(
|
||||
new WndOptions("",
|
||||
Messages.get(MagesStaff.class, "warning"),
|
||||
Messages.get(MagesStaff.class, "yes"),
|
||||
Messages.get(MagesStaff.class, "no")) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0) {
|
||||
Sample.INSTANCE.play(Assets.SND_EVOKE);
|
||||
ScrollOfUpgrade.upgrade(curUser);
|
||||
evoke(curUser);
|
||||
|
||||
Dungeon.quickslot.clearItem(item);
|
||||
|
||||
item.detach(curUser.belongings.backpack);
|
||||
|
||||
imbueWand((Wand) item, curUser);
|
||||
|
||||
curUser.spendAndNext(2f);
|
||||
|
||||
updateQuickslot();
|
||||
if (wand == null){
|
||||
applyWand((Wand)item);
|
||||
} else {
|
||||
GameScene.show(
|
||||
new WndOptions("",
|
||||
Messages.get(MagesStaff.class, "warning"),
|
||||
Messages.get(MagesStaff.class, "yes"),
|
||||
Messages.get(MagesStaff.class, "no")) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0) {
|
||||
applyWand((Wand)item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyWand(Wand wand){
|
||||
Sample.INSTANCE.play(Assets.SND_EVOKE);
|
||||
ScrollOfUpgrade.upgrade(curUser);
|
||||
evoke(curUser);
|
||||
|
||||
Dungeon.quickslot.clearItem(wand);
|
||||
|
||||
wand.detach(curUser.belongings.backpack);
|
||||
Badges.validateTutorial();
|
||||
|
||||
imbueWand((Wand) wand, curUser);
|
||||
|
||||
updateQuickslot();
|
||||
}
|
||||
};
|
||||
|
||||
private final Emitter.Factory StaffParticleFactory = new Emitter.Factory() {
|
||||
|
|
|
@ -714,7 +714,8 @@ items.weapon.melee.magesstaff.cursed=You can't use a cursed wand.
|
|||
items.weapon.melee.magesstaff.warning=Are you sure you want to imbue your staff with this wand?\n\nYour staff will inherit the highest level between it and the wand, and all magic currently affecting the staff will be lost.
|
||||
items.weapon.melee.magesstaff.yes=Yes, I'm sure.
|
||||
items.weapon.melee.magesstaff.no=No, I changed my mind
|
||||
items.weapon.melee.magesstaff.desc=Crafted by the mage himself, this extraordinary staff is a one of a kind multi-purpose magical weapon. Rather than having an innate magic in it, this staff is instead imbued with magical energy from a wand, granting it new power.
|
||||
items.weapon.melee.magesstaff.desc=Crafted by the mage himself, this staff is a one of a kind magical weapon. Rather than having an innate magic in it, this staff is instead imbued with magical energy from a wand, granting it new power.
|
||||
items.weapon.melee.magesstaff.no_wand=The staff currently has no magic in it, it must be _imbued with a wand's power_ before it can be used to cast spells.
|
||||
|
||||
items.weapon.melee.meleeweapon.tier=This is a tier-%d melee weapon.
|
||||
items.weapon.melee.meleeweapon.unknown=Its typical average damage per hit is %d and usually it requires %d points of strength.
|
||||
|
@ -810,7 +811,7 @@ items.brokenseal.prompt=Select an armor
|
|||
items.brokenseal.unknown_armor=You must identify that armor first.
|
||||
items.brokenseal.degraded_armor=That armor is in too poor a condition.
|
||||
items.brokenseal.affix=You affix the sigil to your armor!
|
||||
items.brokenseal.desc=A wax seal, meant to be affixed to armor. The writing on its paper has long since faded, and it is broken down the middle. Through a bit of magic, the seal can be moved between armors, carrying over a single upgrade.\n\nA memento from his home, the seal helps the warrior persevere. While wearing the seal the warrior will slowly generate shielding ontop of his health based on the quality of his armor.
|
||||
items.brokenseal.desc=A wax seal, affixed to armor as a smybol of valor. All the markings on the seal have worn off with age and it is broken in half down the middle.\n\nA memento from his home, the seal helps the warrior persevere. While wearing the seal the warrior will slowly generate shielding ontop of his health based on the quality of his armor.\n\nThe seal can be _affixed to armor,_ and moved between armors. It can carry a single upgrade with it.
|
||||
|
||||
items.dewdrop.name=dewdrop
|
||||
items.dewdrop.value=%+dHP
|
||||
|
|
|
@ -42,8 +42,12 @@ public class WndItem extends Window {
|
|||
|
||||
private static final int WIDTH_P = 120;
|
||||
private static final int WIDTH_L = 144;
|
||||
|
||||
public WndItem( final WndBag owner, final Item item ){
|
||||
this( owner, item, owner != null );
|
||||
}
|
||||
|
||||
public WndItem( final WndBag owner, final Item item ) {
|
||||
public WndItem( final WndBag owner, final Item item , final boolean options ) {
|
||||
|
||||
super();
|
||||
|
||||
|
@ -67,7 +71,7 @@ public class WndItem extends Window {
|
|||
float y = info.top() + info.height() + GAP;
|
||||
float x = 0;
|
||||
|
||||
if (Dungeon.hero.isAlive() && owner != null) {
|
||||
if (Dungeon.hero.isAlive() && options) {
|
||||
ArrayList<RedButton> line = new ArrayList<>();
|
||||
for (final String action:item.actions( Dungeon.hero )) {
|
||||
|
||||
|
@ -75,7 +79,7 @@ public class WndItem extends Window {
|
|||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
owner.hide();
|
||||
if (owner != null) owner.hide();
|
||||
item.execute( Dungeon.hero, action );
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user