v0.9.3: implemented structure for selecting armor abilities
This commit is contained in:
parent
42b1bbc9a6
commit
27a3a37474
|
@ -333,12 +333,12 @@ actors.buffs.wellfed.desc=You feel quite satisfied and full.\n\nWhile well fed,
|
|||
###hero
|
||||
|
||||
##abilities
|
||||
actors.hero.abilities.warrior.warrior1.name=test1
|
||||
actors.hero.abilities.warrior.warrior1.desc=test10
|
||||
actors.hero.abilities.warrior.warrior2.name=test2
|
||||
actors.hero.abilities.warrior.warrior2.desc=test20
|
||||
actors.hero.abilities.warrior.warrior3.name=test3
|
||||
actors.hero.abilities.warrior.warrior3.desc=test30
|
||||
actors.hero.abilities.warrior.warrior1.name=heroic leap
|
||||
actors.hero.abilities.warrior.warrior1.desc=Allows the Warrior to perform a heroic leap towards a targeted location, slamming down to stun all neighbouring enemies.
|
||||
actors.hero.abilities.warrior.warrior2.name=shockwave
|
||||
actors.hero.abilities.warrior.warrior2.desc=Allows the Warrior to slam the ground, disrupting all enemies in a cone AOE in front of him.
|
||||
actors.hero.abilities.warrior.warrior3.name=???
|
||||
actors.hero.abilities.warrior.warrior3.desc=I haven't decided on this ability yet
|
||||
|
||||
actors.hero.hero.name=you
|
||||
actors.hero.hero.leave=You can't leave yet, the rest of the dungeon awaits below!
|
||||
|
|
|
@ -2,8 +2,8 @@ ui.quickslotbutton.select_item=Quickslot an item
|
|||
|
||||
ui.talentspane.tier=tier %d
|
||||
ui.talentspane.unlock_tier2=Reach level 6 to unlock more talents.
|
||||
ui.talentspane.unlock_tier3=Reach level 12 and choose a subclass to unlock more talents.
|
||||
ui.talentspane.coming_soon=More talents coming soon!
|
||||
ui.talentspane.unlock_tier3=Reach level 12 and defeat the second boss to unlock more talents.
|
||||
ui.talentspane.unlock_tier4=Reach level 20 and defeat the fourth boss to unlock more talents.
|
||||
|
||||
ui.toolbar.examine_prompt=Press again to search\nPress a tile to examine
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ windows.wndblacksmith.reforge=Reforge them
|
|||
|
||||
windows.wndchallenges.title=Challenges
|
||||
|
||||
windows.wndchooseability.message=The crown glows as it rests on your head, and both it and your armor become hot to the touch. You can feel the magic of the crown begin to act on your armor, but it must be directed. Which armor ability do you choose?
|
||||
|
||||
windows.wndchooseway.message=As the mask fits over your face, your eyesight fades and visions of new power flood into your mind. How will you direct the mask's power?
|
||||
windows.wndchooseway.cancel=I'll decide later
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ public enum Talent {
|
|||
public static class SuckerPunchTracker extends Buff{};
|
||||
public static class FollowupStrikeTracker extends Buff{};
|
||||
|
||||
public static final int MAX_TALENT_TIERS = 3;
|
||||
public static final int MAX_TALENT_TIERS = 4;
|
||||
|
||||
public static void initClassTalents( Hero hero ){
|
||||
initClassTalents( hero.heroClass, hero.talents );
|
||||
|
@ -505,7 +505,13 @@ public enum Talent {
|
|||
public static void initArmorTalents(ArmorAbility abil, ArrayList<LinkedHashMap<Talent, Integer>> talents ){
|
||||
if (abil == null) return;
|
||||
|
||||
//TODO
|
||||
while (talents.size() < MAX_TALENT_TIERS){
|
||||
talents.add(new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
for (Talent t : abil.talents()){
|
||||
talents.get(3).put(t, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String TALENT_TIER = "talents_tier_";
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
@ -37,6 +38,8 @@ public abstract class ArmorAbility implements Bundlable {
|
|||
return Messages.get(this, "desc");
|
||||
}
|
||||
|
||||
public abstract Talent[] talents();
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
}
|
||||
|
|
|
@ -21,8 +21,13 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
|
||||
public class Warrior1 extends ArmorAbility {
|
||||
|
||||
@Override
|
||||
public Talent[] talents() {
|
||||
return new Talent[]{Talent.HEARTY_MEAL, Talent.ARMSMASTERS_INTUITION, Talent.TEST_SUBJECT, Talent.IRON_WILL};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,13 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
|
||||
public class Warrior2 extends ArmorAbility {
|
||||
|
||||
@Override
|
||||
public Talent[] talents() {
|
||||
return new Talent[]{Talent.EMPOWERING_MEAL, Talent.SCHOLARS_INTUITION, Talent.TESTED_HYPOTHESIS, Talent.BACKUP_BARRIER};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,13 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
|
||||
public class Warrior3 extends ArmorAbility {
|
||||
|
||||
@Override
|
||||
public Talent[] talents() {
|
||||
return new Talent[]{Talent.HEARTY_MEAL, Talent.HEARTY_MEAL, Talent.HEARTY_MEAL, Talent.HEARTY_MEAL};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,17 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndChooseAbility;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -62,7 +65,7 @@ public class KingsCrown extends Item {
|
|||
|
||||
curUser = hero;
|
||||
if (hero.belongings.armor != null){
|
||||
upgrade(hero.belongings.armor);
|
||||
GameScene.show( new WndChooseAbility(this, hero.belongings.armor, hero));
|
||||
} else {
|
||||
GLog.w( Messages.get(this, "naked"));
|
||||
}
|
||||
|
@ -80,19 +83,19 @@ public class KingsCrown extends Item {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void upgrade( Armor armor ) {
|
||||
|
||||
detach( curUser.belongings.backpack );
|
||||
|
||||
curUser.sprite.centerEmitter().start( Speck.factory( Speck.KIT ), 0.05f, 10 );
|
||||
public void upgradeArmor(Hero hero, Armor armor, ArmorAbility ability) {
|
||||
|
||||
detach( hero.belongings.backpack );
|
||||
|
||||
hero.sprite.centerEmitter().start( Speck.factory( Speck.KIT ), 0.05f, 10 );
|
||||
//TODO add a spell icon?
|
||||
curUser.spend( Actor.TICK );
|
||||
curUser.busy();
|
||||
hero.spend( Actor.TICK );
|
||||
hero.busy();
|
||||
|
||||
GLog.p( Messages.get(this, "upgraded"));
|
||||
|
||||
ClassArmor classArmor = ClassArmor.upgrade( curUser, armor );
|
||||
if (curUser.belongings.armor == armor) {
|
||||
ClassArmor classArmor = ClassArmor.upgrade( hero, armor );
|
||||
if (hero.belongings.armor == armor) {
|
||||
|
||||
curUser.belongings.armor = classArmor;
|
||||
((HeroSprite)curUser.sprite).updateArmor();
|
||||
|
@ -104,17 +107,11 @@ public class KingsCrown extends Item {
|
|||
classArmor.collect( curUser.belongings.backpack );
|
||||
|
||||
}
|
||||
hero.armorAbility = ability;
|
||||
Talent.initArmorTalents(hero);
|
||||
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
Sample.INSTANCE.play( Assets.Sounds.MASTERY );
|
||||
}
|
||||
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
KingsCrown.this.upgrade( (Armor)item );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ public class TalentsPane extends ScrollPane {
|
|||
}
|
||||
if (tiersAvailable > 2 && Dungeon.hero.subClass == HeroSubClass.NONE){
|
||||
tiersAvailable = 2;
|
||||
} else if (tiersAvailable > 3 && Dungeon.hero.armorAbility == null){
|
||||
tiersAvailable = 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,12 +97,16 @@ public class TalentsPane extends ScrollPane {
|
|||
|
||||
if (tiersAvailable == 1) {
|
||||
blockText = PixelScene.renderTextBlock(Messages.get(this, "unlock_tier2"), 6);
|
||||
content.add(blockText);
|
||||
} else if (tiersAvailable == 2) {
|
||||
blockText = PixelScene.renderTextBlock(Messages.get(this, "unlock_tier3"), 6);
|
||||
content.add(blockText);
|
||||
} else if (tiersAvailable == 3) {
|
||||
blockText = PixelScene.renderTextBlock(Messages.get(this, "unlock_tier4"), 6);
|
||||
content.add(blockText);
|
||||
} else {
|
||||
blockText = PixelScene.renderTextBlock(Messages.get(this, "coming_soon"), 6);
|
||||
blockText = null;
|
||||
}
|
||||
content.add(blockText);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,15 +127,22 @@ public class TalentsPane extends ScrollPane {
|
|||
|
||||
}
|
||||
|
||||
float bottom = Math.max(height, top + 20);
|
||||
float bottom;
|
||||
if (blockText != null) {
|
||||
bottom = Math.max(height, top + 20);
|
||||
|
||||
blocker.x = 0;
|
||||
blocker.y = top;
|
||||
blocker.size(width, bottom - top);
|
||||
blocker.x = 0;
|
||||
blocker.y = top;
|
||||
blocker.size(width, bottom - top);
|
||||
|
||||
blockText.maxWidth((int)width);
|
||||
blockText.align(RenderedTextBlock.CENTER_ALIGN);
|
||||
blockText.setPos((width - blockText.width())/2f, blocker.y + (bottom - blocker.y - blockText.height())/2);
|
||||
blockText.maxWidth((int) width);
|
||||
blockText.align(RenderedTextBlock.CENTER_ALIGN);
|
||||
blockText.setPos((width - blockText.width()) / 2f, blocker.y + (bottom - blocker.y - blockText.height()) / 2);
|
||||
} else {
|
||||
bottom = Math.max(height, top);
|
||||
|
||||
blocker.visible = false;
|
||||
}
|
||||
|
||||
content.setSize(width, bottom);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2021 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.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.KingsCrown;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
|
||||
public class WndChooseAbility extends Window {
|
||||
|
||||
private static final int WIDTH = 120;
|
||||
private static final float GAP = 2;
|
||||
|
||||
public WndChooseAbility(final KingsCrown crown, final Armor armor, final Hero hero){
|
||||
|
||||
super();
|
||||
|
||||
IconTitle titlebar = new IconTitle();
|
||||
titlebar.icon( new ItemSprite( crown.image(), null ) );
|
||||
titlebar.label( crown.name() );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
|
||||
RenderedTextBlock body = PixelScene.renderTextBlock( 6 );
|
||||
body.text( Messages.get(this, "message"), WIDTH );
|
||||
body.setPos( titlebar.left(), titlebar.bottom() + GAP );
|
||||
add( body );
|
||||
|
||||
float pos = body.bottom() + 3*GAP;
|
||||
for (ArmorAbility ability : hero.heroClass.armorAbilities()) {
|
||||
|
||||
RedButton abilityButton = new RedButton("_" + Messages.titleCase(ability.name()) + ":_ " + ability.desc(), 6){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
super.onClick();
|
||||
hide();
|
||||
crown.upgradeArmor(hero, armor, ability);
|
||||
}
|
||||
};
|
||||
abilityButton.leftJustify = true;
|
||||
abilityButton.multiline = true;
|
||||
abilityButton.setSize(WIDTH, abilityButton.reqHeight()+2);
|
||||
abilityButton.setRect(0, pos, WIDTH, abilityButton.reqHeight()+2);
|
||||
add(abilityButton);
|
||||
pos = abilityButton.bottom() + GAP;
|
||||
}
|
||||
|
||||
resize(WIDTH, (int)pos);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user