mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
show correct max duration for tags
This commit is contained in:
parent
868a5d6157
commit
e21141b06e
@ -84,6 +84,10 @@ interface BaseArenaTag {
|
||||
* The tag's remaining duration. Setting to any number `<=0` will make the tag's duration effectively infinite.
|
||||
*/
|
||||
turnCount: number;
|
||||
/**
|
||||
* The tag's max duration.
|
||||
*/
|
||||
maxDuration: number;
|
||||
/**
|
||||
* The {@linkcode MoveId} that created this tag, or `undefined` if not set by a move.
|
||||
*/
|
||||
@ -110,12 +114,14 @@ export abstract class ArenaTag implements BaseArenaTag {
|
||||
/** The type of the arena tag */
|
||||
public abstract readonly tagType: ArenaTagType;
|
||||
public turnCount: number;
|
||||
public maxDuration: number;
|
||||
public sourceMove?: MoveId;
|
||||
public sourceId: number | undefined;
|
||||
public side: ArenaTagSide;
|
||||
|
||||
constructor(turnCount: number, sourceMove?: MoveId, sourceId?: number, side: ArenaTagSide = ArenaTagSide.BOTH) {
|
||||
this.turnCount = turnCount;
|
||||
this.maxDuration = turnCount;
|
||||
this.sourceMove = sourceMove;
|
||||
this.sourceId = sourceId;
|
||||
this.side = side;
|
||||
@ -164,6 +170,7 @@ export abstract class ArenaTag implements BaseArenaTag {
|
||||
*/
|
||||
loadTag<const T extends this>(source: BaseArenaTag & Pick<T, "tagType">): void {
|
||||
this.turnCount = source.turnCount;
|
||||
this.maxDuration = source.maxDuration;
|
||||
this.sourceMove = source.sourceMove;
|
||||
this.sourceId = source.sourceId;
|
||||
this.side = source.side;
|
||||
|
@ -71,10 +71,11 @@ export class TagAddedEvent extends ArenaEvent {
|
||||
arenaTagType: ArenaTagType,
|
||||
arenaTagSide: ArenaTagSide,
|
||||
duration: number,
|
||||
maxDuration: number,
|
||||
arenaTagLayers?: number,
|
||||
arenaTagMaxLayers?: number,
|
||||
) {
|
||||
super(ArenaEventType.TAG_ADDED, duration);
|
||||
super(ArenaEventType.TAG_ADDED, duration, maxDuration);
|
||||
|
||||
this.arenaTagType = arenaTagType;
|
||||
this.arenaTagSide = arenaTagSide;
|
||||
@ -89,7 +90,7 @@ export class TagRemovedEvent extends ArenaEvent {
|
||||
/** The {@linkcode ArenaTagSide} the tag was being placed on */
|
||||
public arenaTagSide: ArenaTagSide;
|
||||
constructor(arenaTagType: ArenaTagType, arenaTagSide: ArenaTagSide, duration: number) {
|
||||
super(ArenaEventType.TAG_REMOVED, duration);
|
||||
super(ArenaEventType.TAG_REMOVED, duration, duration);
|
||||
|
||||
this.arenaTagType = arenaTagType;
|
||||
this.arenaTagSide = arenaTagSide;
|
||||
|
@ -715,8 +715,8 @@ export class Arena {
|
||||
existingTag.onOverlap(this, globalScene.getPokemonById(sourceId));
|
||||
|
||||
if (existingTag instanceof EntryHazardTag) {
|
||||
const { tagType, side, turnCount, layers, maxLayers } = existingTag as EntryHazardTag;
|
||||
this.eventTarget.dispatchEvent(new TagAddedEvent(tagType, side, turnCount, layers, maxLayers));
|
||||
const { tagType, side, turnCount, maxDuration, layers, maxLayers } = existingTag as EntryHazardTag;
|
||||
this.eventTarget.dispatchEvent(new TagAddedEvent(tagType, side, turnCount, maxDuration, layers, maxLayers));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -731,7 +731,7 @@ export class Arena {
|
||||
const { layers = 0, maxLayers = 0 } = newTag instanceof EntryHazardTag ? newTag : {};
|
||||
|
||||
this.eventTarget.dispatchEvent(
|
||||
new TagAddedEvent(newTag.tagType, newTag.side, newTag.turnCount, layers, maxLayers),
|
||||
new TagAddedEvent(newTag.tagType, newTag.side, newTag.turnCount, newTag.maxDuration, layers, maxLayers),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1041,12 +1041,14 @@ export class GameData {
|
||||
if (globalScene.arena.tags) {
|
||||
for (const tag of globalScene.arena.tags) {
|
||||
if (tag instanceof EntryHazardTag) {
|
||||
const { tagType, side, turnCount, layers, maxLayers } = tag as EntryHazardTag;
|
||||
const { tagType, side, turnCount, maxDuration, layers, maxLayers } = tag as EntryHazardTag;
|
||||
globalScene.arena.eventTarget.dispatchEvent(
|
||||
new TagAddedEvent(tagType, side, turnCount, layers, maxLayers),
|
||||
new TagAddedEvent(tagType, side, turnCount, maxDuration, layers, maxLayers),
|
||||
);
|
||||
} else {
|
||||
globalScene.arena.eventTarget.dispatchEvent(new TagAddedEvent(tag.tagType, tag.side, tag.turnCount));
|
||||
globalScene.arena.eventTarget.dispatchEvent(
|
||||
new TagAddedEvent(tag.tagType, tag.side, tag.turnCount, tag.maxDuration),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
|
||||
this.fieldEffectInfo.push({
|
||||
name,
|
||||
effectType: arenaEffectType,
|
||||
maxDuration: tagAddedEvent.duration,
|
||||
maxDuration: tagAddedEvent.maxDuration,
|
||||
duration: tagAddedEvent.duration,
|
||||
tagType: tagAddedEvent.arenaTagType,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user