HVAN_CHAOTIC

This commit is contained in:
Lemongrass3110 2024-09-18 11:40:30 +02:00
parent d0990e6ee1
commit 0a23c33181

View File

@ -1832,32 +1832,41 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
target_id = target->id;
break;
case HVAN_CHAOTIC:
{
// Chance per skill level
static const uint8 chance_table[2][5] = {
{ 20, 50, 25, 50, 34 }, // Homunculus
{ 30, 10, 50, 4, 33 } // Master
};
{
// Chance per skill level
static const uint8 chance_homunculus[5] = {
20,
50,
25,
50,
34
};
static const uint8 chance_master[5] = {
chance_homunculus[0] + 30,
chance_homunculus[1] + 10,
chance_homunculus[2] + 50,
chance_homunculus[3] + 4,
chance_homunculus[4] + 33
};
uint8 chance = rnd_value(1, 100);
uint8 chance = rnd_value(1, 100);
// Homunculus
if (chance <= chance_table[0][skill_lv - 1])
target = src;
// Master
else if (chance <= (chance_table[0][skill_lv - 1] + chance_table[1][skill_lv - 1]))
target = battle_get_master(src);
// Enemy
else
target = map_id2bl(battle_gettarget(src));
// Homunculus
if (chance <= chance_homunculus[skill_lv - 1])
target = src;
// Master
else if (chance <= chance_master[skill_lv - 1])
target = battle_get_master(src);
// Enemy
else
target = map_id2bl(battle_gettarget(src));
// If there's no enemy the chance reverts to the homunculus
if (target == nullptr)
target = src;
// If there's no enemy the chance reverts to the homunculus
if (target == nullptr)
target = src;
target_id = target->id;
break;
}
target_id = target->id;
} break;
case MH_SONIC_CRAW:
case MH_TINDER_BREAKER: {
int skill_id2 = ((skill_id==MH_SONIC_CRAW)?MH_MIDNIGHT_FRENZY:MH_EQC);