Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator when a candy upgrade is available #1083

Merged
merged 35 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9a98b10
initial implementation
josericardo-fo May 18, 2024
db2b9aa
updated logic
josericardo-fo May 18, 2024
3aa4887
reverse retTint
josericardo-fo May 18, 2024
139f500
added candy overlays and colors
josericardo-fo May 18, 2024
9c5a470
added settings and minor fixes
josericardo-fo May 18, 2024
d748230
german changes
josericardo-fo May 18, 2024
e99dec4
logic fix
josericardo-fo May 18, 2024
e8ba3f7
german changes pt2
josericardo-fo May 18, 2024
4417599
german changes pt3
josericardo-fo May 18, 2024
8ff9d65
setting name changed
josericardo-fo May 18, 2024
182c4a0
Merge branch 'pagefaultgames:main' into candy-upgrade
josericardo-fo May 18, 2024
f0f5a85
Merge branch 'pagefaultgames:main' into candy-upgrade
josericardo-fo May 21, 2024
9ca017c
Merge branch 'main' into candy-upgrade
josericardo-fo May 23, 2024
5696d91
Update battle-scene.ts
josericardo-fo May 23, 2024
9327ec7
Merge branch 'pagefaultgames:main' into candy-upgrade
josericardo-fo May 23, 2024
269dbd4
initial animation implementation
josericardo-fo May 23, 2024
b18ca19
Merge branch 'candy-upgrade' of https://github.com/josericardo-fo/pok…
josericardo-fo May 23, 2024
da56ec1
minor fixes
josericardo-fo May 23, 2024
82f47b6
main compatibility
josericardo-fo May 23, 2024
b3897f0
minor fix
josericardo-fo May 23, 2024
705fe8c
logic for animations
josericardo-fo May 26, 2024
3f7feb5
Merge branch 'pagefaultgames:main' into candy-upgrade
josericardo-fo May 26, 2024
aeef9dd
eslint fixes
josericardo-fo May 26, 2024
2aab5d8
final generation logic
josericardo-fo May 26, 2024
6852084
Merge remote-tracking branch 'upstream/main' into pr/1083
bennybroseph May 26, 2024
4ae3d75
Pause Animation when Selected or Purchased
bennybroseph May 26, 2024
c7844a5
Disable Indicator if not Root Species
bennybroseph May 26, 2024
f291568
Merge branch 'pagefaultgames:main' into candy-upgrade
josericardo-fo May 27, 2024
d2dabf8
Add to Reload and Add Anchor
bennybroseph May 27, 2024
1655138
Merge branch 'candy-upgrade' of https://github.com/josericardo-fo/pok…
bennybroseph May 27, 2024
651e003
Fix Animation on Change
bennybroseph May 27, 2024
e6c9af7
Fix Icon on Change
bennybroseph May 27, 2024
7d54bdc
Merge branch 'main' into candy-upgrade
josericardo-fo May 28, 2024
6216694
Code Cleanup
bennybroseph May 28, 2024
d40133c
fix
josericardo-fo May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/battle-scene-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import Move from "./data/move";

/** Alias for all {@linkcode BattleScene} events */
export enum BattleSceneEventType {
/**
* Triggers when the corresponding setting is changed
* @see {@linkcode CandyUpgradeNotificationChangedEvent}
*/
CANDY_UPGRADE_NOTIFICATION_CHANGED = "onCandyUpgradeDisplayChanged",

/**
* Triggers when a move is successfully used
* @see {@linkcode MoveUsedEvent}
Expand All @@ -24,6 +30,20 @@ export enum BattleSceneEventType {
NEW_ARENA = "onNewArena",
}

/**
* Container class for {@linkcode BattleSceneEventType.CANDY_UPGRADE_NOTIFICATION_CHANGED} events
* @extends Event
*/
export class CandyUpgradeNotificationChangedEvent extends Event {
/** The new value the setting was changed to */
public newValue: number;
constructor(newValue: number) {
super(BattleSceneEventType.CANDY_UPGRADE_NOTIFICATION_CHANGED);

this.newValue = newValue;
}
}

/**
* Container class for {@linkcode BattleSceneEventType.MOVE_USED} events
* @extends Event
Expand Down
13 changes: 13 additions & 0 deletions src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ export default class BattleScene extends SceneBase {
public showLevelUpStats: boolean = true;
public enableTutorials: boolean = import.meta.env.VITE_BYPASS_TUTORIAL === "1";
public enableRetries: boolean = false;
/**
* Determines the condition for a notification should be shown for Candy Upgrades
* - 0 = 'Off'
* - 1 = 'Passives Only'
* - 2 = 'On'
*/
public candyUpgradeNotification: integer = 0;
/**
* Determines what type of notification is used for Candy Upgrades
* - 0 = 'Icon'
* - 1 = 'Animation'
*/
public candyUpgradeDisplay: integer = 0;
public moneyFormat: MoneyFormat = MoneyFormat.NORMAL;
public uiTheme: UiTheme = UiTheme.DEFAULT;
public windowType: integer = 0;
Expand Down
19 changes: 18 additions & 1 deletion src/system/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import BattleScene from "../battle-scene";
import { hasTouchscreen } from "../touch-controls";
import { updateWindowType } from "../ui/ui-theme";
import { PlayerGender } from "./game-data";
import { CandyUpgradeNotificationChangedEvent } from "#app/battle-scene-events.js";
import { MoneyFormat } from "../enums/money-format";

export enum Setting {
Expand All @@ -18,6 +19,8 @@ export enum Setting {
Window_Type = "WINDOW_TYPE",
Tutorials = "TUTORIALS",
Enable_Retries = "ENABLE_RETRIES",
Candy_Upgrade_Notification = "CANDY_UPGRADE_NOTIFICATION",
Candy_Upgrade_Display = "CANDY_UPGRADE_DISPLAY",
Money_Format = "MONEY_FORMAT",
Sprite_Set = "SPRITE_SET",
Move_Animations = "MOVE_ANIMATIONS",
Expand Down Expand Up @@ -52,6 +55,8 @@ export const settingOptions: SettingOptions = {
[Setting.Window_Type]: new Array(5).fill(null).map((_, i) => (i + 1).toString()),
[Setting.Tutorials]: ["Off", "On"],
[Setting.Enable_Retries]: ["Off", "On"],
[Setting.Candy_Upgrade_Notification]: ["Off", "Passives Only", "On"],
[Setting.Candy_Upgrade_Display]: ["Icon", "Animation"],
[Setting.Money_Format]: ["Normal", "Abbreviated"],
[Setting.Sprite_Set]: ["Consistent", "Mixed Animated"],
[Setting.Move_Animations]: ["Off", "On"],
Expand All @@ -78,6 +83,8 @@ export const settingDefaults: SettingDefaults = {
[Setting.Window_Type]: 0,
[Setting.Tutorials]: 1,
[Setting.Enable_Retries]: 0,
[Setting.Candy_Upgrade_Notification]: 0,
[Setting.Candy_Upgrade_Display]: 0,
[Setting.Money_Format]: 0,
[Setting.Sprite_Set]: 0,
[Setting.Move_Animations]: 1,
Expand All @@ -93,7 +100,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Vibration]: 0
};

export const reloadSettings: Setting[] = [Setting.UI_Theme, Setting.Language, Setting.Sprite_Set];
export const reloadSettings: Setting[] = [Setting.UI_Theme, Setting.Language, Setting.Sprite_Set, Setting.Candy_Upgrade_Display];

export function setSetting(scene: BattleScene, setting: Setting, value: integer): boolean {
switch (setting) {
Expand Down Expand Up @@ -127,6 +134,16 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.Enable_Retries:
scene.enableRetries = settingOptions[setting][value] === "On";
break;
case Setting.Candy_Upgrade_Notification:
if (scene.candyUpgradeNotification === value) {
break;
}

scene.candyUpgradeNotification = value;
scene.eventTarget.dispatchEvent(new CandyUpgradeNotificationChangedEvent(value));
break;
case Setting.Candy_Upgrade_Display:
scene.candyUpgradeDisplay = value;
case Setting.Money_Format:
switch (settingOptions[setting][value]) {
case "Normal":
Expand Down
Loading
Loading