Add HP Bar Speed setting and fix Grip Claw HP skip bug

pull/70/head
Flashfyre 2024-04-09 15:34:57 -04:00
parent d9849c5e70
commit 2a6042ff7e
4 changed files with 12 additions and 2 deletions

View File

@ -120,6 +120,7 @@ export default class BattleScene extends SceneBase {
public windowType: integer = 0; public windowType: integer = 0;
public experimentalSprites: boolean = false; public experimentalSprites: boolean = false;
public moveAnimations: boolean = true; public moveAnimations: boolean = true;
public hpBarSpeed: integer = 0;
public fusionPaletteSwaps: boolean = true; public fusionPaletteSwaps: boolean = true;
public enableTouchControls: boolean = false; public enableTouchControls: boolean = false;
public enableVibration: boolean = false; public enableVibration: boolean = false;

View File

@ -1760,7 +1760,7 @@ export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier {
} }
const randItemIndex = pokemon.randSeedInt(itemModifiers.length); const randItemIndex = pokemon.randSeedInt(itemModifiers.length);
const randItem = itemModifiers[randItemIndex]; const randItem = itemModifiers[randItemIndex];
heldItemTransferPromises.push(pokemon.scene.tryTransferHeldItemModifier(randItem, pokemon, false, false, true).then(success => { heldItemTransferPromises.push(pokemon.scene.tryTransferHeldItemModifier(randItem, pokemon, false, false).then(success => {
if (success) { if (success) {
transferredModifierTypes.push(randItem.type); transferredModifierTypes.push(randItem.type);
itemModifiers.splice(randItemIndex, 1); itemModifiers.splice(randItemIndex, 1);

View File

@ -16,6 +16,7 @@ export enum Setting {
Sprite_Set = "SPRITE_SET", Sprite_Set = "SPRITE_SET",
Move_Animations = "MOVE_ANIMATIONS", Move_Animations = "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS", Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
HP_Bar_Speed = "HP_BAR_SPEED",
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS", Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
Player_Gender = "PLAYER_GENDER", Player_Gender = "PLAYER_GENDER",
Touch_Controls = "TOUCH_CONTROLS", Touch_Controls = "TOUCH_CONTROLS",
@ -43,6 +44,7 @@ export const settingOptions: SettingOptions = {
[Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ], [Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ],
[Setting.Move_Animations]: [ 'Off', 'On' ], [Setting.Move_Animations]: [ 'Off', 'On' ],
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ], [Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
[Setting.HP_Bar_Speed]: [ 'Normal', 'Fast', 'Faster', 'Instant' ],
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ], [Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
[Setting.Player_Gender]: [ 'Boy', 'Girl' ], [Setting.Player_Gender]: [ 'Boy', 'Girl' ],
[Setting.Touch_Controls]: [ 'Auto', 'Disabled' ], [Setting.Touch_Controls]: [ 'Auto', 'Disabled' ],
@ -62,6 +64,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Sprite_Set]: 0, [Setting.Sprite_Set]: 0,
[Setting.Move_Animations]: 1, [Setting.Move_Animations]: 1,
[Setting.Show_Stats_on_Level_Up]: 1, [Setting.Show_Stats_on_Level_Up]: 1,
[Setting.HP_Bar_Speed]: 0,
[Setting.Fusion_Palette_Swaps]: 1, [Setting.Fusion_Palette_Swaps]: 1,
[Setting.Player_Gender]: 0, [Setting.Player_Gender]: 0,
[Setting.Touch_Controls]: 0, [Setting.Touch_Controls]: 0,
@ -113,6 +116,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.Show_Stats_on_Level_Up: case Setting.Show_Stats_on_Level_Up:
scene.showLevelUpStats = settingOptions[setting][value] === 'On'; scene.showLevelUpStats = settingOptions[setting][value] === 'On';
break; break;
case Setting.HP_Bar_Speed:
scene.hpBarSpeed = value;
break;
case Setting.Fusion_Palette_Swaps: case Setting.Fusion_Palette_Swaps:
scene.fusionPaletteSwaps = !!value; scene.fusionPaletteSwaps = !!value;
break; break;

View File

@ -349,7 +349,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
}; };
const updatePokemonHp = () => { const updatePokemonHp = () => {
const duration = !instant ? Utils.clampInt(Math.abs((this.lastHp) - pokemon.hp) * 5, 250, 5000) : 0; let duration = !instant ? Utils.clampInt(Math.abs((this.lastHp) - pokemon.hp) * 5, 250, 5000) : 0;
const speed = (this.scene as BattleScene).hpBarSpeed;
if (speed)
duration = speed >= 3 ? 0 : duration / Math.pow(2, speed);
this.scene.tweens.add({ this.scene.tweens.add({
targets: this.hpBar, targets: this.hpBar,
ease: 'Sine.easeOut', ease: 'Sine.easeOut',