45 uint16_t source_index,
46 uint16_t target_index,
49 void *AutoClass32, uint16_t source_index, uint16_t target_index,
52 uint16_t source_index,
53 uint16_t target_index);
55 uint16_t source_index,
56 uint16_t target_index, uint8_t unkn,
59 uint16_t object_index);
62 uint16_t source_index,
63 uint16_t target_index,
87 if (base_val + bonus_val > 0)
89 return ((base_val + bonus_val) * multiplier) / 100;
100 if (base_val + bonus_val > 0)
102 return ((base_val + bonus_val) * multiplier) / 100;
113 return (dex_val + int_val + 100) * 5;
115 return dex_val * 8 + int_val * 5 + 0x578;
160 if ((action.
type != 0) && (action.
type < 10000))
182 uint16_t source_index,
183 uint16_t target_index)
185 uint8_t source_level = _this->
figures[source_index].
level;
186 uint8_t target_level = _this->
figures[target_index].
level;
187 if (target_level < source_level)
189 uint16_t precalc_chance = (source_level - target_level) * 5 + 15;
190 if (precalc_chance > 100)
194 return precalc_chance;
196 if (target_level == source_level)
200 if ( 15 < ((target_level - source_level) * 2))
204 return 15 - (target_level - source_level) * 2;
208 uint16_t source_index,
209 uint16_t target_index,
210 uint16_t weapon_damage)
212 bool apply_set =
false;
216 apply_set = (counter < 0x0b);
225 return weapon_damage;
229 uint16_t source_index,
230 uint16_t target_index,
231 uint16_t weapon_damage)
233 bool apply_set =
false;
237 apply_set = (counter < 0x0b);
240 if ((apply_set) && (weapon_damage != 0x7FFF))
242 uint16_t damage = weapon_damage * 3;
245 return weapon_damage;
249 uint16_t source_index,
250 uint16_t target_index,
251 uint16_t weapon_damage)
253 bool apply_set =
false;
257 apply_set = (counter < 0x0b);
260 if ((apply_set) && (weapon_damage != 0x7FFF))
262 uint16_t damage = weapon_damage * 4;
265 return weapon_damage;
269 uint32_t param_2, uint8_t param_3)
281 uint16_t weapon_damage = weapon_damage_rng + weapon_stats.
min_dmg;
323 damage = ((damage & 0xffff) * ((uint8_t) param_3) + 0x32) / 100;
324 damage = damage & 0xffff;
365 std::list<std::pair<uint16_t, onhit_handler_ptr>> onhit_list =
367 for (
auto it = onhit_list.crbegin(); it != onhit_list.crend(); ++it)
369 std::pair<uint16_t, onhit_handler_ptr> entry = *it;
371 uint16_t spell_line_id = entry.first;
384 damage = onhit_func(_this, source_index, target.
entity_index, damage);
396 damage = onhit_func(_this, source_index, target.
entity_index, damage);
403 if (action.
type == 0x2712)
448 vector.
partA = p1.
Y << 0x10 | p1.
X;
449 vector.
partB = p2.
Y << 0x10 | p2.
X;
453 distance = ((distance & 0xffff) * 1400) / 3000;
457 ((distance != 0) ? distance : 1), &vector);
467 uint16_t subspell_id = 0;
483 if (subspell_id != 0)
526 for (
int i = 0; i < 3; i++)
528 uint16_t enchant_id = *(uint16_t *)((uint32_t)(&puVar15[0]) + i * 2 + 2);
542 uint32_t chance = chance_handler(_this->
CGdFigure, source_index);
563 &source, &target, 0);
SpellFunctions * spellAPI
FigureFunctions * figureAPI
ToolboxFunctions * toolboxAPI
EffectFunctions effectAPI
BuildingFunctions buildingAPI
uint32_t __thiscall getDistance(SF_Coord *pointA, SF_Coord *pointB)
void log_debug(DebugLevel level, const char *format,...)
bool __thiscall hasSpellTag(uint16_t spell_id, SpellTag tag)
void log_info(const char *format,...)
bool __thiscall isActionMelee(SF_SGtFigureAction *_this)
int AddrOf(int offset)
returns "real" virtual address of given memory offset
enchant_handler_ptr get_enchant_handler(uint16_t spell_line)
@ kGdJobStartWorkAtBuilding
@ F_CHECK_SPELLS_BEFORE_JOB
bool isJobDoNothing(uint16_t job_id)
void(__thiscall * FUN_006c3a60_ptr)(void *AutoClass30, uint16_t source_index, uint16_t target_index, uint8_t unkn, uint32_t unkn2)
FUN_0071d7b0_ptr g_FUN_0071d7b0
bool __thiscall isFigureJobSpell(SF_CGdFigureJobs *_this, uint16_t figure_id)
uint16_t __thiscall handle_berserk_set(SF_CGdFigureJobs *_this, uint16_t source_index, uint16_t target_index, uint16_t weapon_damage)
get_hit_chance_ptr g_get_hit_chance
uint16_t get_effect_chance(uint16_t dex_val, uint16_t int_val, uint16_t spell_line)
objectDealDamage_ptr g_objectDealDamage
uint16_t(__thiscall * get_reduced_damage_ptr)(void *AutoClass34, uint16_t source_index, uint16_t target_index, uint16_t unkn)
uint16_t(__thiscall * get_hit_chance_ptr)(void *AutoClass34, uint16_t source_index, uint16_t target_index)
uint32_t(__thiscall * getWeaponEffects_ptr)(void *CGdResource, uint32_t *param1, uint16_t weapon_id)
FUN_00755180_ptr g_FUN_00755180
getWeaponEffects_ptr g_getWeaponEffects
get_reduced_building_damage_ptr g_get_reduced_building_damage
uint16_t __thiscall getCurrentDex(SF_CGdFigure *_this, uint16_t figure_index)
void __thiscall getTargetData(FigureJobData *_this, SF_CGdTargetData *target)
bool __thiscall canJobBeInterrupted(FigureJobs job_id)
uint32_t(__thiscall * objectDealDamage_ptr)(void *CGdObjectToolBox, uint16_t source_index, uint16_t target_index, uint16_t damage, uint32_t unknown)
FUN_006c3a60_ptr g_FUN_006c3a60
uint16_t __thiscall getAttackInterruptionChance(SF_CGdFigure *_this, uint16_t source_index, uint16_t target_index)
void initialize_onhit_data_hooks()
uint32_t(__thiscall * FUN_00755180_ptr)(uint32_t param1)
uint16_t __thiscall handle_trueshot_set(SF_CGdFigureJobs *_this, uint16_t source_index, uint16_t target_index, uint16_t weapon_damage)
get_reduced_damage_ptr g_get_reduced_damage
uint16_t __thiscall handle_riposte_set(SF_CGdFigureJobs *_this, uint16_t source_index, uint16_t target_index, uint16_t weapon_damage)
uint32_t(__thiscall * FUN_0071d7b0_ptr)(void *CGdObject, uint16_t object_index)
uint16_t(__thiscall * get_reduced_building_damage_ptr)(void *AutoClass32, uint16_t source_index, uint16_t target_index, uint16_t damage)
uint16_t __thiscall getCurrentInt(SF_CGdFigure *_this, uint16_t figure_index)
void __thiscall sf_onhit_hook(SF_CGdFigureJobs *_this, uint16_t source_index, uint32_t param_2, uint8_t param_3)
std::list< std::pair< uint16_t, onhit_handler_ptr > > get_onhit_phase(OnHitPhase phase)
uint16_t(__thiscall * enchant_handler_ptr)(SF_CGdFigure *_this, uint16_t figure_id)
uint16_t(__thiscall * onhit_handler_ptr)(SF_CGdFigureJobs *, uint16_t source, uint16_t target, uint16_t damage)
GdBuilding buildings[1000]