Update Beta20.65

Add CustomName in Wepaon and Arrmor
Fixed Bug
This commit is contained in:
LingASDJ 2022-08-15 22:30:30 +08:00
parent 2a723bd2e5
commit b3862ac6cf
35 changed files with 431 additions and 234 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -502,10 +502,11 @@ actors.mobs.ogpdzsls.desc=它们会咬人,但只有大量出现才会危及生
actors.mobs.srpdhblr.name = 赏金猎人
actors.mobs.srpdhblr.desc = 这些赏金猎人曾经想来到这个地牢终结最终的黑暗,没想到现在却被地牢暗处的黑暗魔力给腐蚀。现在他们毫无一点神志,他们游荡在监狱附近,等待下一个来到这个地牢的可怜人。
actors.mobs.randombluefirede.fuck=你很烦人!我要鲨了你!
actors.mobs.randombluefirede.fuck=无知者纵欲奈何,你又有什么资格拯救我们?
actors.mobs.randombluefire.name = 诡异磷魂(狂暴)
actors.mobs.randombluefire.desc = 矮人王国的亡魂和地牢深处溢出的魔力诞生出的诡异生物。他们拥有恐怖的能力,并且半血会进入狂暴状态。但是它们没有视力,你只要不惊扰它们就好。不过,地牢的警报同样会让他们警觉起来。请小心行事!\n\n他们的幻影可能存在这里必须在你离开后才会消失。
actors.mobs.randombluefire.died = 最终,终于还是解脱了……
actors.mobs.randombluefire.desc = 矮人王国的亡魂和地牢深处溢出的魔力诞生出的诡异生物。他们拥有恐怖的能力,并且半血会进入狂暴状态。他们的幻影可能存在这里,必须在击败他们后才会消失。
actors.mobs.randombluefire.notice = 你想尝试磷火带来的痛苦吗?
actors.mobs.randombluefirede.name = 诡异磷魂
actors.mobs.randombluefirede.desc = 矮人王国的亡魂和地牢深处溢出的魔力诞生出的诡异生物。他们拥有恐怖的能力,并且半血会进入狂暴状态。但是它们没有视力,你只要不惊扰它们就好。不过,地牢的警报同样会让他们警觉起来。请小心行事!
@ -514,7 +515,7 @@ actors.mobs.ogpdnqhz.name = 健壮的老鼠
actors.mobs.ogpdnqhz.desc = 这个老鼠很健壮,某些时刻可能给你致命一击
actors.mobs.kagenonusujin.name=影子盗贼
actors.mobs.kagenonusujin.desc=这个邪魔外道的小偷为了偷取什么宝贵之物而在此处游荡着。学习了来自深渊的黑暗法术的他,能够化作黑暗中的影子潜藏其间,又立刻消逝。\n\n这个怪物会尝试造成一次大伤害,之后将瞬移到地图上另一个地方。\n\n如果失败则会召唤爆炎陷阱
actors.mobs.kagenonusujin.desc=这个邪魔外道的小偷为了偷取什么宝贵之物而在此处游荡着。学习了来自深渊的黑暗法术的他,能够化作黑暗中的影子潜藏其间,又立刻消逝。\n\n这个怪物会尝试偷取玩家物品,之后将玩家瞬移到地图上另一个地方,并被魔法反噬流血。\n\n如果失败则会因为魔法反噬而中毒
actors.mobs.fireghost.name=红色怨灵
actors.mobs.fireghost.desc=这只全身赤色的怨灵由地牢深处的死灵学家们从烈焰之中唤醒,虽然它们没有火元素强大,但也已可无限毗近。\n\n这个怪物会点燃你。

View File

@ -233,5 +233,5 @@ levels.prisonlevel.bookshelf_desc=这个书架可能是监狱图书馆的残留
levels.sewerlevel.water_name=圣境水池
levels.sewerlevel.water_desc=进入水潭中可熄灭身上的火焰。\n显然这里的邪恶魔力十分微弱你踩在水上面甚至有_圣境的力量_保护你前行。\n但是在一些魔力聚焦的地方无法影响到你。
levels.sewerlevel.empty_deco_desc=幽蓝且神秘的菌菇长在了这里。
levels.sewerlevel.empty_deco_desc=圣境密林的植物正在这里缓慢生长
levels.sewerlevel.bookshelf_desc=这个书架塞满了没用的成功学书籍。烧掉怎么样?

View File

@ -457,4 +457,6 @@ ui.changelist.mlpd.vm0_6_7_x_changes.bug_06x22=-1.修复了两个种子缺失飞
ui.changelist.mlpd.vm0_6_7_x_changes.bug_06x23=-1.修复了玫瑰秘卷不制作的问题\n-2.修复了矮人大师的小恶魔无限循环问题\n-3.修复了玫瑰秘卷的错误快捷配方
ui.changelist.mlpd.vm0_6_7_x_changes.bug_06x24=-1.修复了DM300闪退的问题\n-2.修复了盗贼披风的天赋不生效问题\n-3.修复了挑战徽章获取异常的问题\n-4.修复了红龙之王的问题\n-5.修复了黑金钥匙使用后不消失的问题\n-6.修复了突变巨兽活死怪的问题\n-7.修复了狱火刻印对磷火无效的问题
ui.changelist.mlpd.vm0_6_7_x_changes.bug_06x25=-1.修复了DM720闪退的问题\n-2.修复了盗贼蝙蝠无限召唤的问题\n-3.修复了矮人大师召唤异常的问题\n-4.修复开发者模式降级变玩家的问题
//ui.changelist.mlpd.vm0_5_x_changes.xxx//

View File

@ -18,6 +18,12 @@ windows.wndstartgame.custom_name_desc=输入你需要的自定义名字,最多
windows.wndstartgame.custom_name_set=接受
windows.wndstartgame.custom_name_clear=清空
windows.wndgame.rename=装备重命名
windows.wndgame.dialog=装备重命名
windows.wndgame.dialog_title=好的装备名字能让你在游戏中更有亲切感\n现在!为你的_装备进行个性化命名设置_吧。\n\n_最多可以输入30字符,若要恢复默认点击该点的按钮_
windows.wndgame.dialog_rename=重命名
windows.wndgame.dialog_revert=恢复默认
windows.wndsettings$datatab.firebase=FireBase数据提交
windows.wndsettings$displaytab.firebase_active=FireBase数据提交
windows.wndsettings$displaytab.firebase_desc=FireBase是一款由_Google_推出的一种开发者服务。Ling在魔绫这边添加了_FireBase崩溃日志收集报告_。\n当你尚未开启此功能时你的_所有崩溃报告都会保存在本地Data数据区域(使用Root才能访问)_\n\n当你开启本功能后你在魔绫游玩的所有崩溃报告将会在下次启动魔绫一并提交到程序后台以便JDSALing我维护。\n-开启此功能代表你同意提交你的崩溃数据和Δ手机的基本公开信息Δ_(手机型号,ROOT权限检测,安卓版本,运存检测,屏幕方向,手机内存)_,同时非常感谢你开启此功能以供Ling后续维护魔绫。\nΔ感谢你的支持与理解同时感谢你的游玩Δ\n\nΞ开启此功能后重启游戏后本地崩溃数据将自动提交到魔绫控制终端Ξ

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

View File

@ -76,6 +76,7 @@ public class Assets {
public static final String TILES_COLD = "environment/Reload.png";
public static final String TILES_DIED = "environment/tiles_died.png";
public static final String TILES_GOLD = "environment/tiles_gold.png";
public static final String WATER_COLD= "environment/water-1.png";
public static final String PRISON_EXIT_OLD = "environment/custom_tiles/prison_exit_old.png";
@ -277,6 +278,7 @@ public class Assets {
public static final String SLIMEPRINCESS = "sprites/boss/SlimePrincess.png";
public static final String ITEMS = "sprites/items/items.png";
public static final String WFS = "sprites/items/wf.png";
public static final String ITEM_ICONS = "sprites/item_icons.png";
public static final String MGAS = "sprites/icemagicgirl.png";

View File

@ -43,7 +43,7 @@ public class SPDSettings extends GameSettings {
public static void quickslots( int value ){
put( KEY_QUICKSLOTS, value );
}
public static String auth_key() { return getString(KEY_AUTH_KEY, DEFAULT_KEY); }
public static int quickslots(){
return getInt( KEY_QUICKSLOTS, 4, Constants.MIN_QUICKSLOTS, Constants.MAX_QUICKSLOTS);
}

View File

@ -33,7 +33,6 @@ import com.watabou.utils.Bundle;
public class Sanity extends Buff {
@Override
//改变buff样子
public int icon() {
if(sanity >= 180) {
return BuffIndicator.BLESS;
@ -65,7 +64,6 @@ public class Sanity extends Buff {
//San值检测系统 V1
if ( (hero.buff(Light.class)==null) ) {
if (sanity >= 180) {
//-1-(1/10)+2=-1-0.1+2=0
sanity -= Dungeon.depth/5+1;
if(sanity == 179) {
GLog.w(Messages.get(Sanity.class,"bad"));
@ -73,7 +71,6 @@ public class Sanity extends Buff {
} else if (sanity >= 120) {
sanity -= Dungeon.depth/5+2;
if(sanity == 119) {
//GLog.n("我在干什么……邪恶的灵魂正在蚕食你……");
GLog.n(Messages.get(Sanity.class,"tobad"));
}
} else {
@ -97,7 +94,6 @@ public class Sanity extends Buff {
}
public void set( int value, int time ) {
//decide whether to override, preferring high value + low interval
if (Math.sqrt(interval)*sanity <= Math.sqrt(time)*value) {
sanity = value;
interval = time;

View File

@ -348,7 +348,6 @@ public enum HeroClass {
hero.belongings.weapon.activate(hero);
WandOfFireblast woc = new WandOfFireblast();
woc.level(Random.NormalIntRange(1,3));
woc.identify().quantity(1).collect();
WandOfFrost wox = new WandOfFrost();

View File

@ -210,9 +210,9 @@ public class Bestiary {
case 8:
return new ArrayList<>(Arrays.asList(Skeleton.class,
Skeleton.class,
Thief.class, Shaman.random(),BrownBat.class,SpectralNecromancer.class,
Thief.class, Shaman.random(),BrownBat.class,KagenoNusujin.class,
Shaman.random(), Guard.class, SRPDHBLR.class,Necromancer.class,
SpectralNecromancer.class,BrownBat.class));
KagenoNusujin.class,BrownBat.class));
case 9:
return new ArrayList<>(Arrays.asList(Skeleton.class, Skeleton.class, Skeleton.class,
Thief.class,Thief.class,BrownBat.class,

View File

@ -38,7 +38,7 @@ public class BlackHost extends Mob {
}
public int damageRoll() {
return Random.NormalIntRange(6, 19);
return Random.NormalIntRange(6, 12);
}
public int drRoll() {

View File

@ -109,7 +109,7 @@ public class FlameC01 extends Mob {
spriteClass = FlameC01Sprite.class;
properties.add(Property.INORGANIC);
properties.add(Property.FIERY);
HP = HT = 120;
HP = HT = 40;
defenseSkill = 23;
EXP = 10;

View File

@ -6,19 +6,26 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonDartTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TeleportationTrap;
import com.shatteredpixel.shatteredpixeldungeon.sprites.KagenoNusujinSprite;
import com.watabou.utils.Random;
public class KagenoNusujin extends Mob {
public class KagenoNusujin extends Thief {
public KagenoNusujin() {
this.spriteClass = KagenoNusujinSprite.class;
this.HT = this.HP =10;
this.HT = this.HP =50;
this.defenseSkill = 16;
this.maxLvl = 34;
this.properties.add(Property.UNDEAD);
WANDERING = new Wandering();
FLEEING = new Fleeing();
}
@Override
public int attackProc(Char var1, int var2) {
int var3 = var2;
if (Random.Int(3) == 0) {
@ -26,11 +33,16 @@ public class KagenoNusujin extends Mob {
TeleportationTrap var4 = new TeleportationTrap();
var4.pos = super.pos;
var4.activate();
if (steal( (Hero)enemy )) {
state = FLEEING;
Buff.affect( this, Bleeding.class ).set( 20f );
}
} else {
var3 = var2 +4;
//BlazingTrap var4 = new BlazingTrap();
//var4.pos = super.pos;
//var4.activate();
PoisonDartTrap var4 = new PoisonDartTrap();
var4.pos = super.pos;
var4.activate();
}
return var3;

View File

@ -183,16 +183,15 @@ public abstract class Mob extends Char {
alerted = false;
if (Dungeon.isChallenged(Challenges.SBSG) && scaleFactor == 1f && !properties().contains(Property.NOBIG)&&!properties().contains(Property.BOSS)){
scaleFactor = Random.Float(1f, 1.8f);
scaleFactor = Random.Float(1f, 1.5f);
HP = HT = (int) (HT * scaleFactor);
if (scaleFactor >= 1.15f){
if (scaleFactor >= 1.45f){
HP = HT = (int) (HT * 1.15f);
}else if (scaleFactor >= 1.4f) {
}else if (scaleFactor >= 1.35f) {
HP = HT = (int) (HT * 1.4f);
}
sprite.linkVisuals(this);
sprite.link(this);
}
if (justAlerted){
@ -877,7 +876,6 @@ public abstract class Mob extends Char {
} else {
BGMPlayer.playBoss();
}
return;
}
}

View File

@ -12,13 +12,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.HalomethaneFire;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlameX;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.FireBallMobSpriteKB;
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
@ -31,8 +31,8 @@ public class RandomBlueFire extends Mob {
public float lifespan;
public RandomBlueFire() {
this.spriteClass = FireBallMobSpriteKB.class;
this.HT = 300;
this.HP = 300;
this.HT = 75;
this.HP = 75;
this.defenseSkill = 10;
this.EXP = 15;
this.loot = new PotionOfLiquidFlameX();
@ -48,7 +48,6 @@ public class RandomBlueFire extends Mob {
@Override
public void notice() {
super.notice();
BossHealthBar.assignBoss(this);
yell( Messages.get(this, "notice") );
}
@ -100,18 +99,27 @@ public class RandomBlueFire extends Mob {
return var3;
}
@Override
public int damageRoll() {
return Random.NormalIntRange(7, 12);
return Random.NormalIntRange( 10, 20 );
}
public void die(Object var1) {
Dungeon.level.drop( new PotionOfLiquidFlameX(), pos ).sprite.drop();
Dungeon.level.drop( new PotionOfLiquidFlameX(), pos ).sprite.drop();
Dungeon.level.drop( new PotionOfHealing(), pos ).sprite.drop();
Dungeon.level.drop( new PotionOfHealing(), pos ).sprite.drop();
super.die(var1);
if (var1 != Chasm.class) {
int var2 = Random.Int(this.deathCurse.length);
this.sprite.showStatus(16711680, this.deathCurse[var2], new Object[0]);
this.sprite.showStatus(16711680, this.deathCurse[var2]);
}
for (Mob mob : (Iterable<Mob>)Dungeon.level.mobs.clone()) {
if ( mob instanceof FlameC01) {
mob.die( var1 );
}
}
yell( Messages.get(this, "died") );
}
protected boolean getCloser(int var1) {

View File

@ -21,16 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.FireBallMobSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Music;
import com.watabou.utils.Random;
public class RandomBlueFireDE extends Mob {
@ -40,33 +36,14 @@ public class RandomBlueFireDE extends Mob {
private String[] deathCurse = {"没有任何的悲哀可以给我,你彻底激怒我了!"};
public RandomBlueFireDE() {
this.spriteClass = FireBallMobSprite.class;
this.HT = 200;
this.HP = 200;
this.HT = 40;
this.HP = 40;
this.defenseSkill = 4;
this.EXP = 7;
this.maxLvl = 15;
this.state = this.SLEEPING;
}
@Override
public boolean act() {
if (Dungeon.level.water[pos] && HP < HT) {
if (Dungeon.level.heroFOV[pos] ){
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
HP++;
Music.INSTANCE.play(Assets.BGM_BOSSA, true);
}
if (state != SLEEPING){
Dungeon.level.seal();
}
return super.act();
}
@Override
public void damage( int dmg, Object src ) {
//半血狂暴
@ -74,34 +51,29 @@ public class RandomBlueFireDE extends Mob {
if (HP <= HT / 2) {
destroy();
Mob mob = new RandomBlueFire();
mob.HP = mob.HT / 2;
mob.HP = mob.HT;
mob.pos = pos;
GameScene.add(mob);
new FlameC01().spawnAround(pos);
Music.INSTANCE.play(Assets.BGM_BOSSD, true);
GLog.n( Messages.get(this, "fuck") );
}
}
@Override
public int damageRoll() {
return Random.NormalIntRange( 1, 2 );
return Random.NormalIntRange( 5, 12 );
}
public int attackProc(Char enemy, int damage) {
if (Random.Int(0, 10) > 7) {
this.sprite.showStatus(16711680, this.attackCurse[Random.Int(this.attackCurse.length)], new Object[0]);
}
int damage2 = RandomBlueFireDE.super.attackProc(enemy, this.combo + damage);
this.combo++;
return damage2;
public int attackProc( Char enemy, int damage ) {
this.sprite.showStatus(16711680, this.attackCurse[Random.Int(this.attackCurse.length)]);
super.attackProc( enemy, damage );
return damage;
}
public void die(Object cause) {
RandomBlueFireDE.super.die(cause);
if (cause != Chasm.class) {
this.sprite.showStatus(16711680, this.deathCurse[Random.Int(this.deathCurse.length)], new Object[0]);
}
}
@ -109,10 +81,5 @@ public class RandomBlueFireDE extends Mob {
public int attackSkill( Char target ) {
return 8;
}
@Override
public int drRoll() {
return Random.NormalIntRange(0, 1);
}
}

View File

@ -48,6 +48,7 @@ public class Rat extends Mob {
if(Dungeon.isChallenged(LIGHTBLACK)) {
if (Random.Int(5) == 1) {
sanity -= 1;
//扣除理智-1
hero.sprite.showStatus( 0x808080, "1");
}
} else {

View File

@ -43,7 +43,7 @@ import com.watabou.utils.Random;
public class RedMurderer extends Mob {
public Item item;
public static int Money = 0;
{
spriteClass = MurdererSprite.RedMuderer.class;
@ -227,8 +227,6 @@ public class RedMurderer extends Mob {
}
if (item != null){
Money++;
System.out.println("测试"+Money);
GLog.n( Messages.get(RedMurderer.class, "escapes", item.name()));
}

View File

@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HalomethaneBurning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob;
@ -47,6 +46,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SlimeKingSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.PathFinder;
@ -54,12 +54,10 @@ import com.watabou.utils.Random;
public class SlimeKing extends Golem implements Callback {
private static final String COMBO = "combo";
private String[] attackCurse = {"雕虫小技", "班门弄斧",
private final String[] attackCurse = {"雕虫小技", "班门弄斧",
"GAMEOVER"};
private int combo = 0;
private static final float TIME_TO_ZAP = 0.5f;
private String[] deathCurse = {"一无所知的蠢货!"};
{
HP =100;
@ -131,7 +129,7 @@ public class SlimeKing extends Golem implements Callback {
@Override
public int attackProc(Char enemy, int damage) {
if (Random.Int(0, 10) > 7) {
this.sprite.showStatus(0x009999, this.attackCurse[Random.Int(this.attackCurse.length)], new Object[0]);
this.sprite.showStatus(0x009999, this.attackCurse[Random.Int(this.attackCurse.length)]);
}
int damage2 = SlimeKing.super.attackProc(enemy, this.combo + damage);
this.combo++;
@ -150,24 +148,6 @@ public class SlimeKing extends Golem implements Callback {
return Random.NormalIntRange(5, 2);
}
private int delay = 0;
private boolean canTryToSummon() {
int ratCount = 0;
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){
if (mob instanceof Rat){
ratCount++;
}
}
if (ratCount < 3 && delay <= 0) {
return true;
} else {
return false;
}
}
private boolean chainsUsed = false;
private boolean chain(int target){
if (chainsUsed || enemy.properties().contains(Property.IMMOVABLE))
@ -197,7 +177,6 @@ public class SlimeKing extends Golem implements Callback {
if (sprite.visible) {
yell(Messages.get(this, "scorpion"));
//summon();
new Item().throwSound();
Sample.INSTANCE.play(Assets.Sounds.CHAINS);
sprite.parent.add(new Chains(sprite.center(), enemy.sprite.center(), new Callback() {
@ -215,7 +194,7 @@ public class SlimeKing extends Golem implements Callback {
}
}
}
//chainsUsed = true;
chainsUsed = true;
return true;
}
@ -229,7 +208,6 @@ public class SlimeKing extends Golem implements Callback {
GameScene.updateFog();
}
}
private int var2;
public void move( int step ) {
@ -237,21 +215,11 @@ public class SlimeKing extends Golem implements Callback {
super.move( step );
}
private void summon() {
delay = 8;
sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.4f, 2 );
Sample.INSTANCE.play( Assets.Sounds.CHALLENGE );
yell( Messages.get(this, "arise") );
}
@Override
public void notice() {
super.notice();
BossHealthBar.assignBoss(this);
//Music.INSTANCE.play(Assets.BGM_BOSSA, true);
Music.INSTANCE.play(Assets.BGM_BOSSA, true);
yell( Messages.get(this, "notice") );
//summon();
}

View File

@ -183,7 +183,7 @@ public class Thief extends Mob {
return desc;
}
private class Wandering extends Mob.Wandering {
public class Wandering extends Mob.Wandering {
@Override
public boolean act(boolean enemyInFOV, boolean justAlerted) {
@ -198,7 +198,7 @@ public class Thief extends Mob {
}
}
private class Fleeing extends Mob.Fleeing {
public class Fleeing extends Mob.Fleeing {
@Override
protected void nowhereToRun() {
if (buff( Terror.class ) == null

View File

@ -33,10 +33,33 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import java.util.ArrayList;
public abstract class EquipableItem extends Item {
public String customName = "";
public String name() {
return this.customName.equals("") ? super.name() : this.customName;
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
if (bundle.contains("customName")) {
this.customName = bundle.getString("customName");
}
}
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
if (!this.customName.equals("")) {
bundle.put("customName", this.customName);
}
}
public static final String AC_EQUIP = "EQUIP";
public static final String AC_UNEQUIP = "UNEQUIP";

View File

@ -63,9 +63,14 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
public abstract class Wand extends Item {
public static final String AC_ZAP = "ZAP";
public String customName = "";
public String name() {
return this.customName.equals("") ? super.name() : this.customName;
}
private static final float TIME_TO_ZAP = 1f;
public int maxCharges = initialCharges();
@ -491,6 +496,10 @@ public abstract class Wand extends Item {
bundle.put( PARTIALCHARGE , partialCharge );
bundle.put( CURSE_INFUSION_BONUS, curseInfusionBonus );
bundle.put( RESIN_BONUS, resinBonus );
if (!this.customName.equals("")) {
bundle.put("customName", this.customName);
}
}
@Override
@ -506,6 +515,9 @@ public abstract class Wand extends Item {
curCharges = bundle.getInt( CUR_CHARGES );
curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN );
partialCharge = bundle.getFloat( PARTIALCHARGE );
if (bundle.contains("customName")) {
this.customName = bundle.getString("customName");
}
}
@Override

View File

@ -323,7 +323,9 @@ public class MagesStaff extends MeleeWeapon {
@Override
public String name() {
if (wand == null) {
if (!super.customName.equals("")) {
return super.name();
} else if (wand == null) {
return super.name();
} else {
String name = Messages.get(wand, "staff_name");

View File

@ -282,7 +282,7 @@ public class CaveTwoBossLevel extends Level {
public void unseal() {
super.unseal();
blobs.get(PylonEnergy.class).fullyClear();
//blobs.get(PylonEnergy.class).fullyClear();
set( entrance, Terrain.ENTRANCE );
int i = 14 + 13*width();

View File

@ -0,0 +1,104 @@
package com.shatteredpixel.shatteredpixeldungeon.levels;
import static com.shatteredpixel.shatteredpixeldungeon.levels.Terrain.WALL;
import static com.shatteredpixel.shatteredpixeldungeon.levels.Terrain.WATER;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
public class ShopBossLevel extends Level {
private static final int W = WALL;
private static final int X = WATER;
private static final int P = Terrain.EMPTY;
private static final int G = Terrain.EMPTY;
private static final int S = Terrain.CHASM;
private static final int R = Terrain.EMPTY_SP;
private static final int J = Terrain.WELL;
private static final int K = Terrain.ALCHEMY;
private static final int D = Terrain.STATUE;
private static final int H = Terrain.PEDESTAL;
private static final int[] code_map = {
W,W,W,W,W,W,W,W,W,W,W,W,S,S,S,S,S,S,S,S,S,S,S,W,W,W,W,W,W,W,W,W,W,W,W,
W,J,P,P,R,P,R,P,P,P,W,W,W,S,S,S,S,S,S,S,S,S,W,W,W,P,P,P,R,P,R,P,P,J,W,
W,P,P,R,R,R,R,R,P,P,W,P,W,W,S,S,S,S,S,S,S,W,W,P,W,P,P,R,R,R,R,R,P,P,W,
W,P,R,P,R,P,R,P,R,P,W,P,P,W,W,S,S,S,S,S,W,W,P,P,W,P,R,P,R,P,R,P,R,P,W,
W,P,P,P,R,P,R,P,R,P,W,P,P,P,W,W,S,S,S,W,W,P,P,P,W,P,R,P,R,P,R,P,P,P,W,
W,P,R,R,R,K,R,R,R,P,W,P,P,P,P,W,W,S,W,W,P,P,P,P,W,P,R,R,R,K,R,R,R,P,W,
W,P,R,P,R,P,R,P,P,P,W,P,P,P,P,P,W,W,W,P,P,P,P,P,W,P,P,P,R,P,R,P,R,P,W,
W,P,R,P,R,P,R,P,R,P,W,P,P,P,P,R,P,W,P,R,P,P,P,P,W,P,R,P,R,P,R,P,R,P,W,
W,P,P,R,R,R,R,R,P,P,W,P,P,P,R,P,P,R,P,P,R,P,P,P,W,P,P,R,R,R,R,R,P,P,W,
W,P,P,P,R,P,R,P,P,W,W,P,P,R,P,P,P,R,P,P,P,R,P,P,W,W,P,P,R,P,R,P,P,P,W,
W,W,W,W,W,W,W,W,W,W,J,P,R,P,P,P,P,R,P,P,P,P,R,P,J,W,W,W,W,W,W,W,W,W,W,
W,W,P,P,P,P,P,P,P,P,P,R,R,R,R,R,R,R,R,R,R,R,R,R,P,P,P,P,P,P,P,P,P,W,W,
S,W,W,P,P,P,P,P,P,P,R,R,R,D,G,G,G,H,X,X,X,X,R,R,R,P,P,P,P,P,P,P,W,W,S,
S,S,W,W,P,P,P,P,P,R,P,R,X,R,G,G,G,R,X,X,X,R,D,R,P,R,P,P,P,P,P,W,W,S,S,
S,S,S,W,W,P,P,P,R,P,P,R,X,X,R,G,G,R,X,X,R,G,G,R,P,P,R,P,P,P,W,W,S,S,S,
S,S,S,S,W,W,P,R,P,P,P,R,X,X,X,R,D,R,X,R,G,G,G,R,P,P,P,R,P,W,W,S,S,S,S,
S,S,S,S,S,W,W,P,P,P,P,R,X,X,X,X,R,R,R,D,G,G,G,R,P,P,P,P,W,W,S,S,S,S,S,
S,S,S,S,S,S,W,W,R,R,R,R,H,R,R,R,R,R,R,R,R,R,H,R,R,R,R,W,W,S,S,S,S,S,S,
S,S,S,S,S,W,W,P,P,P,P,R,G,G,G,D,R,R,R,X,X,X,X,R,P,P,P,P,W,W,S,S,S,S,S,
S,S,S,S,W,W,P,R,P,P,P,R,G,G,G,R,X,R,D,R,X,X,X,R,P,P,P,R,P,W,W,S,S,S,S,
S,S,S,W,W,P,P,P,R,P,P,R,G,G,R,X,X,R,G,G,R,X,X,R,P,P,R,P,P,P,W,W,S,S,S,
S,S,W,W,P,P,P,P,P,R,P,R,D,R,X,X,X,R,G,G,G,R,X,R,P,R,P,P,P,P,P,W,W,S,S,
S,W,W,P,P,P,P,P,P,P,R,R,R,X,X,X,X,H,G,G,G,D,R,R,R,P,P,P,P,P,P,P,W,W,S,
W,W,P,P,P,P,P,P,P,P,P,R,R,R,R,R,R,R,R,R,R,R,R,R,P,P,P,P,P,P,P,P,P,W,W,
W,W,W,W,W,W,W,W,W,W,J,P,R,P,P,P,P,R,P,P,P,P,R,P,J,W,W,W,W,W,W,W,W,W,W,
W,P,R,P,P,P,P,P,R,W,W,P,P,R,P,P,P,R,P,P,P,R,P,P,W,W,R,P,P,P,P,P,R,P,W,
W,P,P,R,P,P,P,R,P,P,W,P,P,P,R,P,P,R,P,P,R,P,P,P,W,P,P,R,P,P,P,R,P,P,W,
W,P,P,P,R,P,R,P,P,P,W,P,P,P,P,R,P,W,P,R,P,P,P,P,W,P,P,P,R,P,R,P,P,P,W,
W,P,P,P,P,R,P,P,P,P,W,P,P,P,P,P,W,W,W,P,P,P,P,P,W,P,P,P,P,R,P,P,P,P,W,
W,P,R,R,R,K,R,R,R,P,W,P,P,P,P,W,W,S,W,W,P,P,P,P,W,P,R,R,R,K,R,R,R,P,W,
W,P,P,P,P,R,P,P,P,P,W,P,P,P,W,W,S,S,S,W,W,P,P,P,W,P,P,P,P,R,P,P,P,P,W,
W,P,R,R,R,R,R,R,R,P,W,P,P,W,W,S,S,S,S,S,W,W,P,P,W,P,R,R,R,R,R,R,R,P,W,
W,P,P,P,P,R,P,P,P,P,W,P,W,W,S,S,S,S,S,S,S,W,W,P,W,P,P,P,P,R,P,P,P,P,W,
W,J,P,P,P,R,P,P,P,P,W,W,W,S,S,S,S,S,S,S,S,S,W,W,W,P,P,P,P,R,P,P,P,J,W,
W,W,W,W,W,W,W,W,W,W,W,W,S,S,S,S,S,S,S,S,S,S,S,W,W,W,W,W,W,W,W,W,W,W,W,
};
{
color1 = 5459774;
color2 = 12179041;
}
protected boolean build() {
setSize(35, 35);
map = code_map.clone();
this.entrance = (this.width * 25) + 17;
exit = 0;
return true;
}
protected void createItems() {
//
}
public Mob createMob() {
return null;
}
protected void createMobs() {
//
}
public int randomRespawnCell() {
return this.entrance - width();
}
public Actor respawner() {
return null;
}
public String tilesTex() {
return Assets.Environment.TILES_COLD;
}
public String waterTex() {
return Assets.Environment.WATER_COLD;
}
}

View File

@ -175,7 +175,7 @@ public class InterlevelScene extends PixelScene {
fadeTime += 0.9f; //adds 1 second total
//speed up transition when debugging
} else if (DeviceCompat.isDebug()){
fadeTime = 0.1f;
fadeTime = 0.8f;
}
SkinnedBlock bg = new SkinnedBlock(Camera.main.width, Camera.main.height, loadingAsset ){

View File

@ -34,7 +34,7 @@ public class FireBallMobSprite extends MobSprite {
TextureFilm frames = new TextureFilm( texture, 10, 14 );
idle = new Animation( 8, true );
idle = new Animation( 14, true );
idle.frames( frames, 0, 1, 2, 3,0, 1, 2, 3,0, 1, 2 ,0, 1, 2, 3 );
run = new Animation( 6, true );

View File

@ -0,0 +1,27 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.watabou.noosa.TextureFilm;
public class WFSprite extends MobSprite {
public WFSprite() {
super();
texture( Assets.Sprites.WFS );
TextureFilm film = new TextureFilm( texture, 16, 16 );
idle = new Animation( 10, true );
idle.frames( film, 1, 1, 1, 1, 1, 0, 0, 0, 0 );
die = new Animation( 20, false );
die.frames( film, 0 );
run = idle.clone();
attack = idle.clone();
idle();
}
}

View File

@ -7,6 +7,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.BlueBatSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.FlameBoiSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.KagenoNusujinSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SRPDHBLRTT;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WFSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.ui.changelist.ChangeButton;
@ -18,6 +21,7 @@ import java.util.ArrayList;
public class vM0_6_7_X_Changes {
public static void addAllChanges(ArrayList<ChangeInfo> changeInfos) {
add_v0_6_5_Changes(changeInfos);
add_v0_6_4_Changes(changeInfos);
add_v0_6_3_Changes(changeInfos);
add_v0_6_2_Changes(changeInfos);
@ -25,6 +29,39 @@ public class vM0_6_7_X_Changes {
add_v0_6_0_Changes(changeInfos);
}
public static void add_v0_6_5_Changes( ArrayList<ChangeInfo> changeInfos ) {
ChangeInfo changes = new ChangeInfo("v0.6.0.0-Beta20.(1-6)", true, "");
changes.hardlight(Window.TITLE_COLOR);
changeInfos.add(changes);
changes = new ChangeInfo("新内容", false, null);
changes.hardlight(Window.GREEN_COLOR);
changeInfos.add(changes);
changes.addButton(new ChangeButton(Icons.get(Icons.INFO), ("其他说明"),
("1.圣境密林层贴图更新\n2.监狱BGM正式实装")));
changes.addButton(new ChangeButton(Icons.get(Icons.RENAME_ON), ("重命名系统"),
("为你中意的英雄进行自定义重命名吧,击败第一大层的任意Boss解锁\n" +
"为你中意的装备进行自定义重命名吧,解锁条件同上所述。")));
changes = new ChangeInfo("改动", false, null);
changes.hardlight(Window.SKYBULE_COLOR);
changeInfos.add(changes);
changes.addButton(new ChangeButton(new SRPDHBLRTT(), ("赏金猎人"),
("伤害下调至9-12")));
changes.addButton(new ChangeButton(new KagenoNusujinSprite(), ("影子盗贼"),
("AI逻辑改变")));
changes.addButton(new ChangeButton(new WFSprite(), ("法师初始改动"),
("茉莉伊洛是双属性的魔法少女,拥有强大的魔力,她将会把烈焰法杖和冰雪法杖进行随机化作为初始法杖")));
changes.addButton(new ChangeButton(new Image("sprites/spinner.png", 144, 0, 16, 16), (Messages.get(ChangesScene.class, "bugfixes")),
Messages.get(vM0_6_7_X_Changes.class, "bug_06X25")));
}
public static void add_v0_6_4_Changes( ArrayList<ChangeInfo> changeInfos ) {
ChangeInfo changes = new ChangeInfo("v0.6.0.0-Beta19", true, "");
changes.hardlight(Window.TITLE_COLOR);

View File

@ -21,106 +21,81 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndInfoItem extends Window {
private static final float GAP = 2;
private static final int WIDTH_MIN = 120;
private static final int WIDTH_MAX = 220;
//only one WndInfoItem can appear at a time
private static WndInfoItem INSTANCE;
public WndInfoItem( Heap heap ) {
super();
if (INSTANCE != null){
INSTANCE.hide();
public WndInfoItem(Heap heap) {
WndInfoItem wndInfoItem = INSTANCE;
if (wndInfoItem != null) {
wndInfoItem.hide();
}
INSTANCE = this;
if (heap.type == Heap.Type.HEAP) {
fillFields( heap.peek() );
fillFields(heap.peek());
} else {
fillFields( heap );
fillFields(heap);
}
}
public WndInfoItem( Item item ) {
super();
if (INSTANCE != null){
INSTANCE.hide();
public WndInfoItem(Item item) {
WndInfoItem wndInfoItem = INSTANCE;
if (wndInfoItem != null) {
wndInfoItem.hide();
}
INSTANCE = this;
fillFields( item );
fillFields(item);
}
private void fillFields(Heap heap) {
IconTitle iconTitle = new IconTitle(heap);
iconTitle.color(16777028);
layoutFields(null, iconTitle, PixelScene.renderTextBlock(heap.info(), 6));
}
private void fillFields(Item item) {
int color;
if ((!(item instanceof EquipableItem) || ((EquipableItem) item).customName.equals("")) && (!(item instanceof Wand) || ((Wand) item).customName.equals(""))) {
color = Window.SKYBULE_COLOR;
} else {
color = Window.CYELLOW;
}
IconTitle iconTitle = new IconTitle(item);
iconTitle.color(color);
layoutFields(item, iconTitle, PixelScene.renderTextBlock(item.info(), 6));
}
private void layoutFields(Item item, IconTitle iconTitle, RenderedTextBlock renderedTextBlock) {
int i = 120;
renderedTextBlock.maxWidth(120);
while (PixelScene.landscape() && renderedTextBlock.height() > 100.0f && i < 220) {
i += 20;
renderedTextBlock.maxWidth(i);
}
if (!Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1) || !(this instanceof WndUseItem) || (!(item instanceof EquipableItem) && !(item instanceof Wand))) {
iconTitle.setRect(0.0f, 0.0f, (float) i, 0.0f);
} else {
iconTitle.setRect(0.0f, 0.0f, (float) (i - 16), 0.0f);
}
add(iconTitle);
renderedTextBlock.setPos(iconTitle.left(), iconTitle.bottom() + 2.0f);
add(renderedTextBlock);
resize(i, (int) (renderedTextBlock.bottom() + 2.0f));
}
@Override
public void hide() {
super.hide();
if (INSTANCE == this){
if (INSTANCE == this) {
INSTANCE = null;
}
}
private void fillFields(Heap heap ) {
IconTitle titlebar = new IconTitle( heap );
titlebar.color( TITLE_COLOR );
RenderedTextBlock txtInfo = PixelScene.renderTextBlock( heap.info(), 6 );
layoutFields(titlebar, txtInfo);
}
private void fillFields( Item item ) {
int color = TITLE_COLOR;
if (item.levelKnown && item.level() > 0) {
color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level() < 0) {
color = ItemSlot.DEGRADED;
}
IconTitle titlebar = new IconTitle( item );
titlebar.color( color );
RenderedTextBlock txtInfo = PixelScene.renderTextBlock( item.info(), 6 );
layoutFields(titlebar, txtInfo);
}
private void layoutFields(IconTitle title, RenderedTextBlock info){
int width = WIDTH_MIN;
info.maxWidth(width);
//window can go out of the screen on landscape, so widen it as appropriate
while (PixelScene.landscape()
&& info.height() > 100
&& width < WIDTH_MAX){
width += 20;
info.maxWidth(width);
}
title.setRect( 0, 0, width, 0 );
add( title );
info.setPos(title.left(), title.bottom() + GAP);
add( info );
resize( width, (int)(info.bottom() + 2) );
}
}
}

View File

@ -287,9 +287,6 @@ public class WndSettings extends WndTabbed {
Boolean landscape = SPDSettings.landscape();
if (landscape == null){
landscape = Game.width > Game.height;
} else {
SPDSettings.toolbarMode(Toolbar.Mode.SPLIT.name());
Toolbar.updateLayout();
}
Boolean finalLandscape = landscape;
btnOrientation = new RedButton(finalLandscape ?

View File

@ -90,8 +90,10 @@ public class WndStartGame extends Window {
}
} );
}
};
};
chkSaver.active = false;
chkSaver.alpha(0.5f);
chkSaver.icon(new ItemSprite(ItemSpriteSheet.DG26, null));
add( chkSaver );
buttons.add(chkSaver);
@ -102,7 +104,7 @@ public class WndStartGame extends Window {
public void onClick() {
if(Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1)){
Game.runOnRenderThread(() -> ShatteredPixelDungeon.scene().add(new WndTextInput(Messages.get(WndStartGame.class,"custom_name"),
Messages.get(WndStartGame.class, "custom_name_desc")+SPDSettings.heroName(),null, SPDSettings.heroName(), 20,
Messages.get(WndStartGame.class, "custom_name_desc")+SPDSettings.heroName(),null, 20,
false, Messages.get(WndStartGame.class,"custom_name_set"),
Messages.get(WndStartGame.class,"custom_name_clear")){
@Override
@ -311,16 +313,15 @@ public class WndStartGame extends Window {
public void update() {
if( !visible && GamesInProgress.selectedClass != null){
visible = true;
optionsPane.setRect(WIDTH-50, HEIGHT-120, 20, 20);
}
super.update();
}
};
optionsPane.layout();
optionsPane.setRect(WIDTH-50, HEIGHT-120, 20, 20);
optionsPane.visible = false;
add(optionsPane);
optionsPane.setRect(WIDTH-500, HEIGHT-1200, 20, 20);
resize(WIDTH, HEIGHT);
}

View File

@ -38,7 +38,7 @@ public class WndTextInput extends Window {
protected TextInput textBox;
public WndTextInput(String custom_name, final String title, final String body, String s, final int maxLength,
public WndTextInput(final String title, final String body, final String initialValue, final int maxLength,
final boolean multiLine, final String posTxt, final String negTxt) {
super();
@ -61,9 +61,9 @@ public class WndTextInput extends Window {
float pos = 2;
if (title != null) {
final RenderedTextBlock txtTitle = PixelScene.renderTextBlock(title, 7);
final RenderedTextBlock txtTitle = PixelScene.renderTextBlock(title, 9);
txtTitle.maxWidth(width);
//txtTitle.hardlight(Window.TITLE_COLOR);
txtTitle.hardlight(Window.TITLE_COLOR);
txtTitle.setPos((width - txtTitle.width()) / 2, 2);
add(txtTitle);
@ -88,7 +88,7 @@ public class WndTextInput extends Window {
hide();
}
};
if (initialValue != null) textBox.setText(initialValue);
textBox.setMaxLength(maxLength);
//sets different height depending on whether this is a single or multi line input.

View File

@ -21,31 +21,38 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.InventoryPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.Image;
import java.util.ArrayList;
public class WndUseItem extends WndInfoItem {
private static final float BUTTON_HEIGHT = 16;
private static final float GAP = 2;
public WndUseItem( final Window owner, final Item item ) {
super(item);
private static final float GAP = 2;
public WndUseItem( final Window owner, final Item item ) {
super(item);
float y = height;
if (Dungeon.hero.isAlive() && Dungeon.hero.belongings.contains(item)) {
y += GAP;
ArrayList<RedButton> buttons = new ArrayList<>();
for (final String action : item.actions( Dungeon.hero )) {
RedButton btn = new RedButton( item.actionName(action, Dungeon.hero), 8 ) {
@Override
protected void onClick() {
@ -55,7 +62,7 @@ public class WndUseItem extends WndInfoItem {
item.execute( Dungeon.hero, action );
}
Item.updateQuickslot();
if (action == item.defaultAction && item.usesTargeting && owner == null){
if (action.equals(item.defaultAction) && item.usesTargeting && owner == null){
InventoryPane.useTargeting();
}
}
@ -67,21 +74,75 @@ public class WndUseItem extends WndInfoItem {
if (action.equals(item.defaultAction)) {
btn.textColor( TITLE_COLOR );
}
if (Badges.isUnlocked(Badges.Badge.BOSS_SLAIN_1)) {
label43: {
boolean var9 = item instanceof EquipableItem;
if (!var9) {
if (!(item instanceof Wand)) {
break label43;
}
}
Image var12 = Icons.get(Icons.RENAME_OFF);
Image var11 = var12;
if (var9) {
if (!((EquipableItem)item).customName.equals("")) {
var11 = Icons.get(Icons.RENAME_ON);
}
}
if (item instanceof Wand) {
if (!((Wand)item).customName.equals("")) {
Icons.get(Icons.RENAME_ON);
}
}
IconButton Rename = new IconButton(var11) {
public String hoverText() {
return Messages.titleCase(Messages.get(WndGame.class, "rename"));
}
public void onClick() {
GameScene.show(new WndTextInput(Messages.get(WndGame.class, "dialog"), Messages.get(WndGame.class, "dialog_title"), item.name(), 30, false, Messages.get(WndGame.class, "dialog_rename"), Messages.get(WndGame.class, "dialog_revert")) {
public void onSelect(boolean name, String str) {
if (name) {
if (item instanceof EquipableItem) {
((EquipableItem) item).customName = str;
} else {
((Wand) item).customName = str;
}
} else {
if (item instanceof EquipableItem) {
((EquipableItem) item).customName = "";
} else {
((Wand) item).customName = "";
}
}
WndUseItem.this.hide();
GameScene.show(new WndUseItem(owner, item));
}
});
}
};
Rename.setRect((float)(super.width - 16), 0.0F, 16.0F, 16.0F);
this.add(Rename);
}
}
}
y = layoutButtons(buttons, width, y);
}
resize( width, (int)(y) );
}
private static float layoutButtons(ArrayList<RedButton> buttons, float width, float y){
ArrayList<RedButton> curRow = new ArrayList<>();
float widthLeftThisRow = width;
while( !buttons.isEmpty() ){
RedButton btn = buttons.get(0);
widthLeftThisRow -= btn.width();
if (curRow.isEmpty()) {
curRow.add(btn);
@ -93,22 +154,22 @@ public class WndUseItem extends WndInfoItem {
buttons.remove(btn);
}
}
//layout current row. Currently forces a max of 3 buttons but can work with more
if (buttons.isEmpty() || widthLeftThisRow <= 0 || curRow.size() >= 3){
//re-use this variable for laying out the buttons
widthLeftThisRow = width - (curRow.size()-1);
for (RedButton b : curRow){
widthLeftThisRow -= b.width();
}
//while we still have space in this row, find the shortest button(s) and extend them
while (widthLeftThisRow > 0){
ArrayList<RedButton> shortest = new ArrayList<>();
RedButton secondShortest = null;
for (RedButton b : curRow) {
if (shortest.isEmpty()) {
shortest.add(b);
@ -124,9 +185,9 @@ public class WndUseItem extends WndInfoItem {
}
}
}
float widthToGrow;
if (secondShortest == null){
widthToGrow = widthLeftThisRow / shortest.size();
widthLeftThisRow = 0;
@ -139,28 +200,28 @@ public class WndUseItem extends WndInfoItem {
widthLeftThisRow -= widthToGrow * shortest.size();
}
}
for (RedButton toGrow : shortest){
toGrow.setRect(0, 0, toGrow.width()+widthToGrow, toGrow.height());
}
}
//finally set positions
float x = 0;
for (RedButton b : curRow){
b.setRect(x, y, b.width(), b.height());
x += b.width() + 1;
}
//move to next line and reset variables
y += BUTTON_HEIGHT+1;
widthLeftThisRow = width;
curRow.clear();
}
}
return y - 1;
}