Skip to content

Commit

Permalink
fix(items): make item healing come from new properties, not stats
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Mar 21, 2023
1 parent 40e8e14 commit 856c600
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CONTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Items require:
* `givesAbility` - optional, the ability the item gives (by ability name)
* `stats` - the stats the item gives - see items for how to declare this, and see Stats for the valid stats
* `foodDuration` - optional, if specified, the item can be used as a food for combat and will give its `stats` every combat
* `oocHealth` - optional, if specified, will let the player use this item out of combat (if it's `type='Foods'`) and restore this value to health
* `oocEnergy` - optional, if specified, will let the player use this item out of combat (if it's `type='Foods'`) and restore this value to energy

# Adding a New Gathering Location

Expand Down
3 changes: 3 additions & 0 deletions content/data/items/food.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ Pine Nuts:
durability: 1
value: 1
icon: meal
oocHealth: 5
oocEnergy: 5
stats:
healing: 50


Cooked Cropfish:
name: Pine Nuts
description: Once cooked you can eat them whole. Although, I would rather not eat them at all.
Expand Down
2 changes: 1 addition & 1 deletion scripts/item-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const validStats = [
'pickaxePowerPercent', 'axePowerPercent', 'fishingPowerPercent', 'scythePowerPercent', 'huntingPowerPercent',
'pickaxeSpeed', 'axeSpeed', 'fishingSpeed', 'scytheSpeed', 'huntingSpeed',
'pickaxeSpeedPercent', 'axeSpeedPercent', 'fishingSpeedPercent', 'scytheSpeedPercent', 'huntingSpeedPercent',
'armor', 'mitigation', 'healing', 'energy', 'attack', 'energyBonus', 'healthBonus', 'health', 'speed',
'armor', 'mitigation', 'healing', 'attack', 'energyBonus', 'healthBonus', 'health', 'speed',
'healingPerRound', 'healingPerCombat', 'energyPerRound', 'energyPerCombat'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class StatNameDisplayComponent implements OnInit {

public readonly statNames: Record<Stat, string> = {
['health' as Stat]: 'Health',
[Stat.Energy]: 'Energy',
['energy' as Stat]: 'Energy',

[Stat.PickaxePower]: 'Pickaxe Power',
[Stat.AxePower]: 'Axe Power',
Expand Down Expand Up @@ -58,7 +58,7 @@ export class StatNameDisplayComponent implements OnInit {

public readonly tooltips: Record<Stat, string> = {
['health' as Stat]: 'Your total health',
[Stat.Energy]: 'Your total energy',
['energy' as Stat]: 'Your total energy',

[Stat.PickaxePower]: 'Mining nodes will take less time (in seconds) to complete',
[Stat.AxePower]: 'Logging nodes will take less time (in seconds) to complete',
Expand Down
1 change: 0 additions & 1 deletion src/app/helpers/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function defaultStatsZero(): Record<Stat, number> {
[Stat.Armor]: 0,
[Stat.Mitigation]: 0,
[Stat.Healing]: 0,
[Stat.Energy]: 0,
[Stat.Attack]: 0,
[Stat.EnergyBonus]: 0,
[Stat.HealthBonus]: 0,
Expand Down
7 changes: 5 additions & 2 deletions src/app/pages/character/inventory/inventory.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@
{{ item.name }}
</ion-item>

<ion-item class="cursor-pointer" (click)="eat(item)" *ngIf="item.category === 'Foods' && ((item.stats?.healing || 0) > 0 || (item.stats?.energy || 0) > 0)">
Eat To Heal
<ion-item class="cursor-pointer" (click)="eat(item)" *ngIf="item.category === 'Foods' && ((item.oocHealth || 0) > 0 || (item.oocEnergy || 0) > 0)">
<ion-label class="ion-text-wrap">
Eat To Heal
<span *ngIf="item.oocHealth || item.oocEnergy">&nbsp;(+{{ item.oocHealth || 0 }}/{{ item.oocEnergy || 0}} HP/Energy)</span>
</ion-label>
</ion-item>

<ion-item class="cursor-pointer" (click)="quickSell(item)">
Expand Down
3 changes: 2 additions & 1 deletion src/interfaces/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export enum Stat {
Armor = 'armor',
Mitigation = 'mitigation',
Healing = 'healing',
Energy = 'energy',
Attack = 'attack',
EnergyBonus = 'energyBonus',
HealthBonus = 'healthBonus',
Expand Down Expand Up @@ -155,6 +154,8 @@ export interface IGameItem {
quantity?: number;
givesAbility?: string;
effects?: IGameCombatAbilityEffect[];
oocHealth?: number;
oocEnergy?: number;
stats: Record<Stat, number>;

foodDuration?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/stores/combat/combat.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ export function oocEatFood(ctx: StateContext<IGameCombat>, { item }: OOCEatFood)
return;
}

const healing = item.stats[Stat.Healing] ?? 0;
const energy = item.stats[Stat.Energy] ?? 0;
const healing = item.oocHealth ?? 0;
const energy = item.oocEnergy ?? 0;
if(healing <= 0 && energy <= 0) {
return;
}
Expand Down

0 comments on commit 856c600

Please sign in to comment.