This commit is contained in:
Nikolaj
2025-08-05 11:16:34 +02:00
parent c1424c7650
commit 5045bbfa2a
4 changed files with 24 additions and 327 deletions

View File

@@ -3,330 +3,8 @@ const sheets = foundry.applications.sheets;
export default class pokemonCharacterSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) {
effectivenessChart = {
"normal": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 1,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 1,
"bug": 1,
"rock": 0.5,
"ghost": 0,
"dragon": 1,
"dark": 1,
"steel": 0.5
},
"fire": {
"normal": 1,
"fire": 0.5,
"water": 0.5,
"electric": 1,
"grass": 2,
"ice": 2,
"fighting": 1,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 1,
"bug": 2,
"rock": 0.5,
"ghost": 1,
"dragon": 0.5,
"dark": 1,
"steel": 2
},
"water": {
"normal": 1,
"fire": 2,
"water": 0.5,
"electric": 1,
"grass": 0.5,
"ice": 1,
"fighting": 1,
"poison": 1,
"ground": 2,
"flying": 1,
"psychic": 1,
"bug": 1,
"rock": 2,
"ghost": 1,
"dragon": 0.5,
"dark": 1,
"steel": 1
},
"electric": {
"normal": 1,
"fire": 1,
"water": 2,
"electric": 0.5,
"grass": 0.5,
"ice": 1,
"fighting": 1,
"poison": 1,
"ground": 0,
"flying": 2,
"psychic": 1,
"bug": 1,
"rock": 1,
"ghost": 1,
"dragon": 0.5,
"dark": 1,
"steel": 1
},
"grass": {
"normal": 1,
"fire": 0.5,
"water": 2,
"electric": 1,
"grass": 0.5,
"ice": 1,
"fighting": 1,
"poison": 0.5,
"ground": 2,
"flying": 0.5,
"psychic": 1,
"bug": 0.5,
"rock": 2,
"ghost": 1,
"dragon": 0.5,
"dark": 1,
"steel": 0.5
},
"ice": {
"normal": 1,
"fire": 0.5,
"water": 0.5,
"electric": 1,
"grass": 2,
"ice": 0.5,
"fighting": 1,
"poison": 1,
"ground": 2,
"flying": 2,
"psychic": 1,
"bug": 1,
"rock": 1,
"ghost": 1,
"dragon": 2,
"dark": 1,
"steel": 0.5
},
"fighting": {
"normal": 2,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 2,
"fighting": 1,
"poison": 0.5,
"ground": 1,
"flying": 0.5,
"psychic": 0.5,
"bug": 0.5,
"rock": 2,
"ghost": 0,
"dragon": 1,
"dark": 2,
"steel": 2
},
"poison": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 2,
"ice": 1,
"fighting": 1,
"poison": 0.5,
"ground": 0.5,
"flying": 1,
"psychic": 1,
"bug": 1,
"rock": 0.5,
"ghost": 0.5,
"dragon": 1,
"dark": 1,
"steel": 0
},
"ground": {
"normal": 1,
"fire": 2,
"water": 1,
"electric": 2,
"grass": 0.5,
"ice": 1,
"fighting": 1,
"poison": 2,
"ground": 1,
"flying": 0,
"psychic": 1,
"bug": 0.5,
"rock": 2,
"ghost": 1,
"dragon": 1,
"dark": 1,
"steel": 2
},
"flying": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 0.5,
"grass": 2,
"ice": 1,
"fighting": 2,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 1,
"bug": 2,
"rock": 0.5,
"ghost": 1,
"dragon": 1,
"dark": 1,
"steel": 0.5
},
"psychic": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 2,
"poison": 2,
"ground": 1,
"flying": 1,
"psychic": 0.5,
"bug": 1,
"rock": 1,
"ghost": 1,
"dragon": 1,
"dark": 0,
"steel": 0.5
},
"bug": {
"normal": 1,
"fire": 0.5,
"water": 1,
"electric": 1,
"grass": 2,
"ice": 1,
"fighting": 0.5,
"poison": 0.5,
"ground": 1,
"flying": 0.5,
"psychic": 2,
"bug": 1,
"rock": 1,
"ghost": 0.5,
"dragon": 1,
"dark": 2,
"steel": 0.5
},
"rock": {
"normal": 1,
"fire": 2,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 2,
"fighting": 0.5,
"poison": 1,
"ground": 0.5,
"flying": 2,
"psychic": 1,
"bug": 2,
"rock": 1,
"ghost": 1,
"dragon": 1,
"dark": 1,
"steel": 0.5
},
"ghost": {
"normal": 0,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 1,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 2,
"bug": 1,
"rock": 1,
"ghost": 2,
"dragon": 1,
"dark": 0.5,
"steel": 0.5
},
"dragon": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 1,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 1,
"bug": 1,
"rock": 1,
"ghost": 1,
"dragon": 2,
"dark": 1,
"steel": 0.5
},
"dark": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 0.5,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 2,
"bug": 1,
"rock": 1,
"ghost": 2,
"dragon": 1,
"dark": 0.5,
"steel": 0.5
},
"steel": {
"normal": 1,
"fire": 0.5,
"water": 0.5,
"electric": 0.5,
"grass": 1,
"ice": 2,
"fighting": 1,
"poison": 1,
"ground": 1,
"flying": 1,
"psychic": 1,
"bug": 1,
"rock": 2,
"ghost": 1,
"dragon": 1,
"dark": 1,
"steel": 0.5
}
}
'Normal': {'Rock': '0.5', 'Ghost': '0', 'Steel': '0.5'}, 'Fire': {'Fire': '0.5', 'Water': '0.5', 'Grass': '2', 'Ice': '2', 'Bug': '2', 'Rock': '0.5', 'Dragon': '0.5', 'Steel': '2'}, 'Water': {'Fire': '2', 'Water': '0.5', 'Grass': '0.5', 'Ground': '2', 'Rock': '2', 'Dragon': '0.5'}, 'Electric': {'Water': '2', 'Electric': '0.5', 'Grass': '0.5', 'Ground': '0', 'Flying': '2', 'Dragon': '0.5'}, 'Grass': {'Fire': '0.5', 'Water': '2', 'Grass': '0.5', 'Poison': '0.5', 'Ground': '2', 'Flying': '0.5', 'Bug': '0.5', 'Rock': '2', 'Dragon': '0.5', 'Steel': '0.5'}, 'Ice': {'Fire': '0.5', 'Water': '0.5', 'Grass': '2', 'Ice': '0.5', 'Ground': '2', 'Flying': '2', 'Dragon': '2', 'Steel': '0.5'}, 'Fighting': {'Normal': '2', 'Ice': '2', 'Poison': '0.5', 'Flying': '0.5', 'Psychic': '0.5', 'Bug': '0.5', 'Rock': '2', 'Ghost': '0', 'Dark': '2', 'Steel': '2', 'Fairy': '0.5'}, 'Poison': {'Grass': '2', 'Poison': '0.5', 'Ground': '0.5', 'Rock': '0.5', 'Ghost': '0.5', 'Steel': '0', 'Fairy': '2'}, 'Ground': {'Fire': '2', 'Electric': '2', 'Grass': '0.5', 'Poison': '2', 'Flying': '0', 'Bug': '0.5', 'Rock': '2', 'Steel': '2'}, 'Flying': {'Electric': '0.5', 'Grass': '2', 'Fighting': '2', 'Bug': '2', 'Rock': '0.5', 'Steel': '0.5'}, 'Psychic': {'Fighting': '2', 'Poison': '2', 'Psychic': '0.5', 'Dark': '0', 'Steel': '0.5'}, 'Bug': {'Fire': '0.5', 'Grass': '2', 'Fighting': '0.5', 'Poison': '0.5', 'Flying': '0.5', 'Psychic': '2', 'Ghost': '0.5', 'Dark': '2', 'Steel': '0.5', 'Fairy': '0.5'}, 'Rock': {'Fire': '0.5', 'Ice': '2', 'Fighting': '0.5', 'Ground': '0.5', 'Flying': '2', 'Bug': '2', 'Steel': '0.5'}, 'Ghost': {'Normal': '0', 'Psychic': '2', 'Ghost': '2', 'Dark': '0.5'}, 'Dragon': {'Dragon': '2', 'Steel': '0.5', 'Fairy': '0'}, 'Dark': {'Fighting': '0.5', 'Psychic': '2', 'Ghost': '2', 'Dark': '0.5', 'Fairy': '0.5'}, 'Steel': {'Fire': '0.5', 'Water': '0.5', 'Electric': '0.5', 'Ice': '2', 'Rock': '2', 'Steel': '0.5', 'Fairy': '2'}, 'Fairy': {'Fire': '0.5', 'Fighting': '2', 'Poison': '0.5', 'Dragon': '2', 'Dark': '2', 'Steel': '0.5'}
};
sheetContext = {};
@@ -419,10 +97,10 @@ export default class pokemonCharacterSheet extends api.HandlebarsApplicationMixi
calcEffectiveness(context, type) {
var effectiveness = 1
effectiveness *= this.effectivenessChart[type][context.system.type1]
effectiveness *= this.effectivenessChart[type][context.system.type1] ?? 1;
if (context.system.type2 != "") {
effectiveness *= this.effectivenessChart[type][context.system.type2]
effectiveness *= this.effectivenessChart[type][context.system.type2] ?? 1;
}
return effectiveness