Skip to content

Commit

Permalink
Updated melee combatant and added boss combatant.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchyDev committed Oct 14, 2023
1 parent 1f1d9c8 commit de8a525
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 57 deletions.
19 changes: 18 additions & 1 deletion data/sql/db-world/base/tos_world_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
DELETE FROM `instance_template` WHERE `map`=44;
INSERT INTO `instance_template` (`map`, `parent`, `script`, `allowMount`) VALUES (44, 0, 'instance_trial_of_strength', 0);



-- Combatant / Melee
DELETE FROM `creature_template` WHERE `entry`=441251;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441251, 0, 0, 0, 0, 0, 2072, 0, 0, 0, 'Enemy Combatant', NULL, NULL, 0, 80, 80, 0, 17, 0, 1, 1.14286, 1, 1, 20, 1, 3, 0, 5, 2000, 2000, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'CombatAI', 0, 1, 5, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSEnemyCombatantScript', 1);
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441251, 0, 0, 0, 0, 0, 3960, 4443, 4021, 4024, 'Enemy Combatant', 'Melee', NULL, 0, 80, 80, 0, 17, 0, 1, 1.14286, 1, 1, 20, 1, 0, 0, 5, 2000, 2000, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'CombatAI', 0, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSEnemyCombatantScript', 1);

DELETE FROM `creature_equip_template` WHERE `CreatureID`=441251 AND `ID`=1;
INSERT INTO `creature_equip_template` (`CreatureID`, `ID`, `ItemID1`, `ItemID2`, `ItemID3`, `VerifiedBuild`) VALUES (441251, 1, 1899, 2052, 0, NULL);


-- Combatant / Melee Boss
DELETE FROM `creature_template` WHERE `entry`=441252;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441252, 0, 0, 0, 0, 0, 3960, 4443, 4021, 4024, 'Enemy Combatant', 'Boss', NULL, 0, 80, 80, 0, 17, 0, 1, 1.14286, 1, 1, 20, 1.5, 3, 0, 5, 2000, 2000, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'CombatAI', 0, 1, 6, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSEnemyCombatantBossScript', 1);

DELETE FROM `creature_equip_template` WHERE `CreatureID`=441252 AND `ID`=1;
INSERT INTO `creature_equip_template` (`CreatureID`, `ID`, `ItemID1`, `ItemID2`, `ItemID3`, `VerifiedBuild`) VALUES (441252, 1, 1899, 2052, 0, NULL);


-- Trial of Strength / Arena Master
DELETE FROM `creature_template` WHERE `entry`=441250;
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (441250, 0, 0, 0, 0, 0, 18039, 0, 0, 0, 'Fortichad Ironfist', 'Arena Master', NULL, 0, 80, 80, 0, 35, 3, 1, 1.14286, 1, 1, 20, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'ToSArenaMasterScript', 1);


CREATE TABLE IF NOT EXISTS `tos_reward_template` (
`id` int DEFAULT NULL,
`item_entry` int DEFAULT NULL,
Expand Down
5 changes: 5 additions & 0 deletions src/TrialOfStrength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "ToSHelpers.h"

#include "scripts/ToSEnemyCombatantScript.h"
#include "scripts/ToSEnemyCombatantBossScript.h"

#include "scripts/ToSArenaMasterScript.h"
#include "scripts/ToSInstanceScript.h"

Expand Down Expand Up @@ -181,6 +183,9 @@ void SC_AddTrialOfStrengthScripts()
{
new ToSWorldScript();
new ToSArenaMasterScript();

new ToSEnemyCombatantScript();
new ToSEnemyCombatantBossScript();

new instance_trial_of_strength();
}
185 changes: 185 additions & 0 deletions src/scripts/ToSEnemyCombatantBossScript.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
#ifndef MODULE_TRIAL_OF_STRENGTH_ENEMY_COMBATANT_BOSS_H
#define MODULE_TRIAL_OF_STRENGTH_ENEMY_COMBATANT_BOSS_H

#include "ScriptMgr.h"

class ToSEnemyCombatantBossScript : public CreatureScript
{
public:
ToSEnemyCombatantBossScript() : CreatureScript("ToSEnemyCombatantBossScript") { }

virtual CreatureAI* GetAI(Creature* creature) const
{
return new ToSEnemyCombatantBossAI(creature);
}

struct ToSEnemyCombatantBossAI : public CombatAI
{
enum CombatantEvents
{
TOS_EVENT_COMBATANT_START_PUNCHING = 1,
TOS_EVENT_COMBATANT_AURA_ANGRY = 68335, /* Enrage */
TOS_EVENT_COMBATANT_SPELL_PUNCH = 29581,
};

EventMap events;

bool isPunching;
bool isAngry;

ToSEnemyCombatantBossAI(Creature* creature) : CombatAI(creature)
{
events.Reset();

isPunching = false;
isAngry = false;
}

void Reset() override
{
if (me->HasAura(TOS_EVENT_COMBATANT_AURA_ANGRY))
{
me->RemoveAura(TOS_EVENT_COMBATANT_AURA_ANGRY);
}

isPunching = false;
isAngry = false;

events.Reset();
}

void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;

events.Update(diff);

switch (events.ExecuteEvent())
{
case TOS_EVENT_COMBATANT_START_PUNCHING:
TryPunching();

events.RescheduleEvent(TOS_EVENT_COMBATANT_START_PUNCHING, 3s);
break;
}

if (me->GetHealthPct() < 66 && !isPunching)
{
isPunching = true;

events.ScheduleEvent(TOS_EVENT_COMBATANT_START_PUNCHING, 1s);
}

if (me->GetHealthPct() < 50 && !isAngry)
{
GetAngry();
}

DoMeleeAttackIfReady();
}

void GetAngry()
{
me->AddAura(TOS_EVENT_COMBATANT_AURA_ANGRY, me);

isAngry = true;

auto rand = urand(0, 3);
switch (rand)
{
case 0:
me->Yell("I will show you real strength!", LANG_UNIVERSAL);
break;

case 1:
me->Yell("I was just warming up!", LANG_UNIVERSAL);
break;

case 2:
me->Yell("I am going to pound you into the dirt.", LANG_UNIVERSAL);
break;

case 3:
me->Yell("Am I a joke to you?", LANG_UNIVERSAL);
break;

default:
return;
}
}

void TryPunching()
{
auto creature = me->GetVictim();
if (!creature)
{
return;
}

me->CastSpell(creature, TOS_EVENT_COMBATANT_SPELL_PUNCH);
}

void JustEngagedWith(Unit* who) override
{
auto rand = urand(0, 3);
std::string message;

switch (rand)
{
case 0:
message = "You may have bested my constituents, but you havent fought me yet.";
break;

case 1:
message = "You will pay for your bloodshed.";
break;

case 2:
message = "Now the real challenge begins.";
break;

case 3:
message = "What time is it? Pounding time.";
break;

default:
return;
}

me->Yell(message, LANG_UNIVERSAL);
}

void JustDied(Unit* killer) override
{
auto rand = urand(0, 3);
std::string message;

switch (rand)
{
case 0:
message = "You are stronger.. than you appear..";
break;

case 1:
message = "This isn't how it was supposed to go..";
break;

case 2:
message = "Who are you?..";
break;

case 3:
message = "Ugh..";
break;

default:
return;
}

me->Yell(message, LANG_UNIVERSAL);
}
};
};

#endif // MODULE_TRIAL_OF_STRENGTH_ENEMY_COMBATANT_BOSS_H
Loading

0 comments on commit de8a525

Please sign in to comment.