Merge pull request #79 from hppeng-wynn/atree-misc-patch

Implement int and costs jankily
This commit is contained in:
hppeng-wynn 2022-07-06 11:36:47 -07:00 committed by GitHub
commit eec6544a33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 142 additions and 91 deletions

View file

@ -3730,7 +3730,7 @@
"sdRaw": 200, "sdRaw": 200,
"wDamPct": -20, "wDamPct": -20,
"eDamPct": 25, "eDamPct": 25,
"spPct4": -46, "spPct4": -45,
"id": 131 "id": 131
}, },
{ {
@ -7287,8 +7287,8 @@
"agi": 11, "agi": 11,
"def": 11, "def": 11,
"hpBonus": -300, "hpBonus": -300,
"spPct2": 24, "spPct2": 25,
"spPct4": -24, "spPct4": -23,
"id": 359 "id": 359
}, },
{ {
@ -9950,9 +9950,9 @@
"def": -20, "def": -20,
"atkTier": -1, "atkTier": -1,
"hprRaw": -200, "hprRaw": -200,
"spPct2": -32, "spPct2": -31,
"spPct3": -21, "spPct3": -21,
"spPct4": -24, "spPct4": -23,
"id": 482 "id": 482
}, },
{ {
@ -10022,7 +10022,7 @@
"spd": -8, "spd": -8,
"hpBonus": 1750, "hpBonus": 1750,
"hprRaw": 125, "hprRaw": 125,
"spPct1": -48, "spPct1": -47,
"id": 490 "id": 490
}, },
{ {
@ -13227,7 +13227,7 @@
"aDamPct": 12, "aDamPct": 12,
"tDamPct": 15, "tDamPct": 15,
"fixID": true, "fixID": true,
"spPct3": -10, "spPct3": -9,
"id": 629 "id": 629
}, },
{ {
@ -13963,7 +13963,7 @@
"eSteal": 4, "eSteal": 4,
"aDamPct": 12, "aDamPct": 12,
"tDamPct": 10, "tDamPct": 10,
"spPct1": -10, "spPct1": -9,
"spPct4": -14, "spPct4": -14,
"id": 658 "id": 658
}, },
@ -15415,7 +15415,7 @@
"aDamPct": 21, "aDamPct": 21,
"fixID": true, "fixID": true,
"spPct2": -54, "spPct2": -54,
"spPct3": -34, "spPct3": -33,
"id": 726 "id": 726
}, },
{ {
@ -15850,7 +15850,7 @@
"wDefPct": -45, "wDefPct": -45,
"eDefPct": -55, "eDefPct": -55,
"spPct2": -14, "spPct2": -14,
"spPct3": -10, "spPct3": -9,
"id": 2264 "id": 2264
}, },
{ {
@ -16582,10 +16582,10 @@
"wDamPct": 50, "wDamPct": 50,
"type": "necklace", "type": "necklace",
"fixID": true, "fixID": true,
"spPct1": 130, "spPct1": 91,
"spPct2": 85, "spPct2": 61,
"spPct3": 130, "spPct3": 91,
"spPct4": 100, "spPct4": 70,
"id": 3618 "id": 3618
}, },
{ {
@ -16846,7 +16846,7 @@
"mdRaw": 1997, "mdRaw": 1997,
"fixID": true, "fixID": true,
"spPct1": 23, "spPct1": 23,
"spPct2": 15, "spPct2": 16,
"spPct3": 32, "spPct3": 32,
"spPct4": 23, "spPct4": 23,
"id": 782 "id": 782
@ -18545,7 +18545,7 @@
"tDamPct": 10, "tDamPct": 10,
"spPct1": -21, "spPct1": -21,
"spPct2": -14, "spPct2": -14,
"spPct3": -18, "spPct3": -17,
"spPct4": -21, "spPct4": -21,
"id": 860 "id": 860
}, },
@ -19351,8 +19351,8 @@
"mdPct": 15, "mdPct": 15,
"spd": 10, "spd": 10,
"hpBonus": -300, "hpBonus": -300,
"spPct1": 24, "spPct1": 25,
"spPct3": -24, "spPct3": -23,
"jh": 1, "jh": 1,
"id": 898 "id": 898
}, },
@ -23028,10 +23028,10 @@
"ref": 20, "ref": 20,
"int": -40, "int": -40,
"spd": 8, "spd": 8,
"spPct1": -18, "spPct1": -17,
"spPct2": -10, "spPct2": -9,
"spPct3": -18, "spPct3": -17,
"spPct4": -10, "spPct4": -9,
"id": 1070 "id": 1070
}, },
{ {
@ -24203,7 +24203,7 @@
"aDamPct": -33, "aDamPct": -33,
"tDamPct": -33, "tDamPct": -33,
"eDamPct": -33, "eDamPct": -33,
"spPct3": -23, "spPct3": -22,
"id": 1143 "id": 1143
}, },
{ {
@ -26886,7 +26886,7 @@
"str": 4, "str": 4,
"dex": 4, "dex": 4,
"mdRaw": 52, "mdRaw": 52,
"spPct1": 18, "spPct1": 19,
"id": 1261 "id": 1261
}, },
{ {
@ -27362,8 +27362,8 @@
"tDefPct": 40, "tDefPct": 40,
"eDefPct": 40, "eDefPct": 40,
"fixID": true, "fixID": true,
"spPct3": -18, "spPct3": -17,
"spPct4": -18, "spPct4": -17,
"id": 1279 "id": 1279
}, },
{ {
@ -35174,7 +35174,7 @@
"dex": 4, "dex": 4,
"sdRaw": 13, "sdRaw": 13,
"mdRaw": 13, "mdRaw": 13,
"spPct1": 18, "spPct1": 19,
"id": 1658 "id": 1658
}, },
{ {
@ -35953,7 +35953,7 @@
"def": 15, "def": 15,
"fDamPct": 40, "fDamPct": 40,
"wDamPct": 40, "wDamPct": 40,
"spPct1": -23, "spPct1": -22,
"id": 1689 "id": 1689
}, },
{ {
@ -36059,7 +36059,7 @@
"tDamPct": 55, "tDamPct": 55,
"eDamPct": 55, "eDamPct": 55,
"aDefPct": 35, "aDefPct": 35,
"spPct3": -52, "spPct3": -51,
"sprintReg": 43, "sprintReg": 43,
"id": 3643 "id": 3643
}, },
@ -36591,7 +36591,7 @@
"fDamPct": 45, "fDamPct": 45,
"wDamPct": -1000, "wDamPct": -1000,
"aDamPct": 45, "aDamPct": 45,
"spPct3": -16, "spPct3": -15,
"id": 3646 "id": 3646
}, },
{ {
@ -36900,7 +36900,7 @@
"eSteal": 10, "eSteal": 10,
"hprRaw": -270, "hprRaw": -270,
"mdRaw": 285, "mdRaw": 285,
"spPct3": -30, "spPct3": -29,
"id": 1716 "id": 1716
}, },
{ {
@ -44272,7 +44272,7 @@
"fDamPct": 45, "fDamPct": 45,
"wDamPct": -25, "wDamPct": -25,
"eDamPct": -25, "eDamPct": -25,
"spPct3": -23, "spPct3": -22,
"id": 2063 "id": 2063
}, },
{ {
@ -47040,7 +47040,7 @@
"ms": 5, "ms": 5,
"lb": 10, "lb": 10,
"str": -5, "str": -5,
"spPct1": -25, "spPct1": -24,
"id": 2182 "id": 2182
}, },
{ {
@ -49765,8 +49765,8 @@
"agi": 7, "agi": 7,
"def": 7, "def": 7,
"wDamPct": -15, "wDamPct": -15,
"spPct1": -10, "spPct1": -9,
"spPct3": -10, "spPct3": -9,
"id": 2327 "id": 2327
}, },
{ {
@ -54851,7 +54851,7 @@
"def": 4, "def": 4,
"spd": 10, "spd": 10,
"fixID": true, "fixID": true,
"spPct1": -18, "spPct1": -17,
"id": 2579 "id": 2579
}, },
{ {
@ -58543,7 +58543,7 @@
"spRegen": 10, "spRegen": 10,
"aDefPct": 10, "aDefPct": 10,
"fixID": true, "fixID": true,
"spPct1": -18, "spPct1": -17,
"id": 2763 "id": 2763
}, },
{ {
@ -61862,10 +61862,10 @@
"mr": 5, "mr": 5,
"sdPct": -25, "sdPct": -25,
"fixID": true, "fixID": true,
"spPct1": -18, "spPct1": -17,
"spPct2": -18, "spPct2": -17,
"spPct3": -18, "spPct3": -17,
"spPct4": -18, "spPct4": -17,
"id": 2900 "id": 2900
}, },
{ {
@ -62221,7 +62221,7 @@
"hprRaw": -40, "hprRaw": -40,
"sdRaw": 95, "sdRaw": 95,
"fixID": true, "fixID": true,
"spPct3": -10, "spPct3": -9,
"id": 2915 "id": 2915
}, },
{ {
@ -66367,7 +66367,7 @@
"hprRaw": 150, "hprRaw": 150,
"spPct1": -7, "spPct1": -7,
"spPct2": -14, "spPct2": -14,
"spPct3": -10, "spPct3": -9,
"id": 3094 "id": 3094
}, },
{ {
@ -70048,7 +70048,7 @@
"lb": 25, "lb": 25,
"hprRaw": -101, "hprRaw": -101,
"spPct2": -31, "spPct2": -31,
"spPct4": -10, "spPct4": -9,
"jh": 2, "jh": 2,
"id": 3621 "id": 3621
}, },
@ -70785,7 +70785,7 @@
"fDamPct": -30, "fDamPct": -30,
"wDamPct": 20, "wDamPct": 20,
"tDefPct": -25, "tDefPct": -25,
"spPct3": -24, "spPct3": -23,
"id": 3309 "id": 3309
}, },
{ {
@ -71213,9 +71213,9 @@
"spd": 10, "spd": 10,
"fDamPct": 10, "fDamPct": 10,
"wDamPct": -15, "wDamPct": -15,
"spPct1": -10, "spPct1": -9,
"spPct3": -7, "spPct3": -7,
"spPct4": -10, "spPct4": -9,
"id": 3327 "id": 3327
}, },
{ {
@ -72481,9 +72481,9 @@
"int": -24, "int": -24,
"agi": 12, "agi": 12,
"spd": 15, "spd": 15,
"spPct1": -10, "spPct1": -9,
"spPct3": -7, "spPct3": -7,
"spPct4": -18, "spPct4": -17,
"id": 3385 "id": 3385
}, },
{ {
@ -73096,7 +73096,7 @@
"ms": 5, "ms": 5,
"def": -12, "def": -12,
"spd": 12, "spd": 12,
"spPct1": -23, "spPct1": -22,
"id": 3413 "id": 3413
}, },
{ {

File diff suppressed because one or more lines are too long

View file

@ -293,7 +293,7 @@ const atree_merge = new (class extends ComputeNode {
} }
return abils_merged; return abils_merged;
} }
})().link_to(atree_node, 'atree').link_to(atree_state_node, 'atree-state'); // TODO: THIS IS WRONG!!!!! Need one "collect" node... })().link_to(atree_node, 'atree').link_to(atree_state_node, 'atree-state');
/** /**
* Validate ability tree. * Validate ability tree.
@ -475,7 +475,7 @@ const atree_collect_spells = new (class extends ComputeNode {
case 'add_spell_prop': { case 'add_spell_prop': {
const { base_spell, target_part = null, cost = 0, behavior = 'merge'} = effect; const { base_spell, target_part = null, cost = 0, behavior = 'merge'} = effect;
if (base_spell !== base_spell_id) { continue; } // TODO: redundant? if we assume abils only affect one spell if (base_spell !== base_spell_id) { continue; } // TODO: redundant? if we assume abils only affect one spell
if ('cost' in ret_spell) { ret_spell.cost += cost; } // TODO: unjankify this... if ('cost' in ret_spell) { ret_spell.cost += cost; }
if (target_part === null) { if (target_part === null) {
continue; continue;
@ -542,6 +542,51 @@ const atree_collect_spells = new (class extends ComputeNode {
} }
})().link_to(atree_merge, 'atree-merged'); })().link_to(atree_merge, 'atree-merged');
const atree_stats = new (class extends ComputeNode {
constructor() { super('atree-stats-collector'); }
compute_func(input_map) {
if (input_map.size !== 1) { throw "AbilityTreeCollectStats accepts exactly one input (atree-merged)"; }
const [atree_merged] = input_map.values(); // Extract values, pattern match it into size one list and bind to first element
let ret_effects = new Map();
for (const [abil_id, abil] of atree_merged.entries()) {
if (abil.effects.length == 0) { continue; }
for (const effect of abil.effects) {
switch (effect.type) {
case 'stat_scaling':
// TODO: handle
continue;
case 'raw_stat':
// TODO: toggles...
for (const bonus of effect.bonuses) {
const { type, name, abil = "", value } = bonus;
// TODO: prop
if (type === "stat") {
if (ret_effects.has(name)) { ret_effects.set(name, ret_effects.get(name) + value); }
else { ret_effects.set(name, value); }
}
}
continue;
case 'add_spell_prop':
// TODO unjankify....
// costs are converted to raw cost ID
const { base_spell, cost = 0} = effect;
if (cost) {
const key = "spRaw"+base_spell;
if (ret_effects.has(key)) { ret_effects.set(key, ret_effects.get(key) + cost); }
else { ret_effects.set(key, cost); }
}
continue;
}
}
}
console.log(ret_effects);
return ret_effects;
}
})().link_to(atree_merge, 'atree-merged');
/** /**
* Construct compute nodes to link builder items and edit IDs to the appropriate display outputs. * Construct compute nodes to link builder items and edit IDs to the appropriate display outputs.

View file

@ -2201,7 +2201,7 @@ const atrees = {
"type": "stat", "type": "stat",
"name": "spd" "name": "spd"
}, },
"scaling": [1, 1], "scaling": [2, 2],
"max": 20 "max": 20
} }
] ]
@ -2474,7 +2474,7 @@ const atrees = {
{ {
"display_name": "Fire Mastery", "display_name": "Fire Mastery",
"desc": "Increases base damage from all Earth attacks", "desc": "Increases base damage from all Fire attacks",
"archetype": "Paladin", "archetype": "Paladin",
"archetype_req": 0, "archetype_req": 0,
"parents": ["War Scream"], "parents": ["War Scream"],
@ -2595,12 +2595,7 @@ const atrees = {
"base_spell": 3, "base_spell": 3,
"target_part": "Uppercut", "target_part": "Uppercut",
"cost": -10, "cost": -10,
"multipliers": [-70, 0, 0, 0, 0, 0] "multipliers": [-70, 0, 0, 30, 0, 0]
},
{
"type": "convert_spell_conv",
"target_part": "all",
"conversion": "Water"
} }
] ]
}, },
@ -2686,6 +2681,8 @@ const atrees = {
{ {
"display_name": "Iron Lungs", "display_name": "Iron Lungs",
"desc": "War Scream deals more damage", "desc": "War Scream deals more damage",
"archetype": "Paladin",
"archetype_req": 0,
"base_abil": "War Scream", "base_abil": "War Scream",
"parents": ["Flyby Jab", "Flaming Uppercut"], "parents": ["Flyby Jab", "Flaming Uppercut"],
"dependencies": [], "dependencies": [],
@ -2957,13 +2954,13 @@ const atrees = {
"col": 6, "col": 6,
"icon": "node_1" "icon": "node_1"
}, },
"properties": {}, "properties": {"attackRate": 2},
"effects": [ "effects": [
{ {
"type": "add_spell_prop", "type": "add_spell_prop",
"base_spell": 4, "base_spell": 4,
"target_part": "Air Shout", "target_part": "Air Shout",
"multipliers": [20, 0, 0, 0, 0, 5] "multipliers": [40, 0, 0, 0, 0, 10]
} }
] ]
}, },
@ -3026,7 +3023,7 @@ const atrees = {
"type": "add_spell_prop", "type": "add_spell_prop",
"base_spell": 2, "base_spell": 2,
"target_part": "Flying Kick", "target_part": "Flying Kick",
"multipliers": [120, 0, 0, 10, 0, 20] "multipliers": [150, 0, 0, 20, 0, 30]
}, },
{ {
"type": "add_spell_prop", "type": "add_spell_prop",
@ -3306,7 +3303,7 @@ const atrees = {
"base_spell": 2, "base_spell": 2,
"target_part": "Collide", "target_part": "Collide",
"cost": 0, "cost": 0,
"multipliers": [100, 0, 0, 0, 50, 0] "multipliers": [150, 0, 0, 0, 50, 0]
}, },
{ {
"type": "add_spell_prop", "type": "add_spell_prop",
@ -3782,8 +3779,8 @@ const atrees = {
{ "type": "stat", "name": "fDamAddMin" }, { "type": "stat", "name": "fDamAddMax" }, { "type": "stat", "name": "fDamAddMin" }, { "type": "stat", "name": "fDamAddMax" },
{ "type": "stat", "name": "aDamAddMin" }, { "type": "stat", "name": "aDamAddMax" } { "type": "stat", "name": "aDamAddMin" }, { "type": "stat", "name": "aDamAddMax" }
], ],
"scaling": [2], "scaling": [3],
"max": 50 "max": 80
} }
] ]
}, },

File diff suppressed because one or more lines are too long

View file

@ -181,7 +181,8 @@ class ItemInputNode extends InputNode {
if (item) { if (item) {
if (powdering !== undefined) { if (powdering !== undefined) {
item.statMap.set('powders', powdering); const max_slots = item.statMap.get('slots');
item.statMap.set('powders', powdering.slice(0, max_slots));
} }
let type_match; let type_match;
if (this.category == 'weapon') { if (this.category == 'weapon') {
@ -1105,6 +1106,7 @@ function builder_graph_init() {
atree_merge.link_to(build_node, 'build'); atree_merge.link_to(build_node, 'build');
atree_graph_creator = new AbilityTreeEnsureNodesNode(build_node, stat_agg_node) atree_graph_creator = new AbilityTreeEnsureNodesNode(build_node, stat_agg_node)
.link_to(atree_collect_spells, 'spells'); .link_to(atree_collect_spells, 'spells');
stat_agg_node.link_to(atree_stats, 'atree-stats');
build_encode_node.link_to(atree_node, 'atree').link_to(atree_state_node, 'atree-state'); build_encode_node.link_to(atree_node, 'atree').link_to(atree_state_node, 'atree-state');

View file

@ -1572,7 +1572,7 @@ function getSpellCost(stats, spell) {
function getBaseSpellCost(stats, spell) { function getBaseSpellCost(stats, spell) {
// old intelligence: // old intelligence:
let cost = spell.cost; //Math.ceil(spell.cost * (1 - skillPointsToPercentage(stats.get('int')))); let cost = Math.ceil(spell.cost * (1 - skillPointsToPercentage(stats.get('int')) * skillpoint_final_mult[2]));
cost += stats.get("spRaw"+spell.base_spell); cost += stats.get("spRaw"+spell.base_spell);
return Math.floor(cost * (1 + stats.get("spPct"+spell.base_spell) / 100)); return Math.floor(cost * (1 + stats.get("spPct"+spell.base_spell) / 100));
} }

View file

@ -1,4 +1,4 @@
const DB_VERSION = 92; const DB_VERSION = 93;
// @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA // @See https://github.com/mdn/learning-area/blob/master/javascript/apis/client-side-storage/indexeddb/video-store/index.jsA
let db; let db;

View file

@ -169,14 +169,14 @@ function calc_weapon_powder(weapon, damageBases) {
let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]); let min_diff = Math.min(neutralRemainingRaw[0], conversionRatio * neutralBase[0]);
let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]); let max_diff = Math.min(neutralRemainingRaw[1], conversionRatio * neutralBase[1]);
//damages[element+1][0] = Math.floor(round_near(damages[element+1][0] + min_diff)); damages[element+1][0] = Math.floor(round_near(damages[element+1][0] + min_diff));
//damages[element+1][1] = Math.floor(round_near(damages[element+1][1] + max_diff)); damages[element+1][1] = Math.floor(round_near(damages[element+1][1] + max_diff));
//neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff)); neutralRemainingRaw[0] = Math.floor(round_near(neutralRemainingRaw[0] - min_diff));
//neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff)); neutralRemainingRaw[1] = Math.floor(round_near(neutralRemainingRaw[1] - max_diff));
damages[element+1][0] += min_diff; //damages[element+1][0] += min_diff;
damages[element+1][1] += max_diff; //damages[element+1][1] += max_diff;
neutralRemainingRaw[0] -= min_diff; //neutralRemainingRaw[0] -= min_diff;
neutralRemainingRaw[1] -= max_diff; //neutralRemainingRaw[1] -= max_diff;
} }
damages[element+1][0] += powder.min; damages[element+1][0] += powder.min;
damages[element+1][1] += powder.max; damages[element+1][1] += powder.max;

View file

@ -44,17 +44,18 @@ for item in items:
known_item_names.add(item["name"]) known_item_names.add(item["name"])
# TEMP wynn2 migration # TEMP wynn2 migration
# note: 10x'd
mul_keys = { mul_keys = {
"spPct1": 0.7, "spPct1": 7,
"spPct2": 0.7, "spPct2": 7,
"spPct3": 0.7, "spPct3": 7,
"spPct4": 0.7, "spPct4": 7,
"spRaw1": 5, "spRaw1": 50,
"spRaw2": 5, "spRaw2": 50,
"spRaw3": 5, "spRaw3": 50,
"spRaw4": 5, "spRaw4": 50,
"mr": 5, "mr": 50,
"ms": 5 "ms": 50
} }
remap_items = [] remap_items = []
@ -63,7 +64,13 @@ import math
for item in old_items: for item in old_items:
for k, v in mul_keys.items(): for k, v in mul_keys.items():
if k in item: if k in item:
item[k] = math.floor(round(item[k] * v)) # SUPER JANKY ROUNDING
tentimes = round(item[k] * v)
rem = tentimes % 10
val = math.floor(round(tentimes / 10))
if rem >= 5:
val += 1
item[k] = val
if "remapID" in item: if "remapID" in item:
remap_items.append(item) remap_items.append(item)
elif item["name"] not in known_item_names: elif item["name"] not in known_item_names: