mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Restructured Arrays to Vectors
This commit is contained in:
parent
6fb652f642
commit
b836952356
@ -1468,7 +1468,7 @@ void MobManager::followToCombat(Mob *mob) {
|
|||||||
void MobManager::useAbilities(Mob *mob, time_t currTime) {
|
void MobManager::useAbilities(Mob *mob, time_t currTime) {
|
||||||
if (mob->skillStyle >= 0) { // corruption hit
|
if (mob->skillStyle >= 0) { // corruption hit
|
||||||
int skillID = (int)mob->data["m_iCorruptionType"];
|
int skillID = (int)mob->data["m_iCorruptionType"];
|
||||||
int targetData[5] = {1, mob->target->plr->iID, 0, 0, 0};
|
std::vector<int> targetData = {1, mob->target->plr->iID, 0, 0, 0};
|
||||||
int temp = mob->skillStyle;
|
int temp = mob->skillStyle;
|
||||||
mob->skillStyle = -3; // corruption cooldown
|
mob->skillStyle = -3; // corruption cooldown
|
||||||
mob->nextAttack = currTime + 1000;
|
mob->nextAttack = currTime + 1000;
|
||||||
@ -1478,7 +1478,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) {
|
|||||||
|
|
||||||
if (mob->skillStyle == -2) { // eruption hit
|
if (mob->skillStyle == -2) { // eruption hit
|
||||||
int skillID = (int)mob->data["m_iMegaType"];
|
int skillID = (int)mob->data["m_iMegaType"];
|
||||||
int targetData[5] = {0, 0, 0, 0, 0};
|
std::vector<int> targetData = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
// find the players within range of eruption
|
// find the players within range of eruption
|
||||||
for (auto it = mob->viewableChunks->begin(); it != mob->viewableChunks->end(); it++) {
|
for (auto it = mob->viewableChunks->begin(); it != mob->viewableChunks->end(); it++) {
|
||||||
@ -1519,7 +1519,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) {
|
|||||||
|
|
||||||
if (random < prob1) { // active skill hit
|
if (random < prob1) { // active skill hit
|
||||||
int skillID = (int)mob->data["m_iActiveSkill1"];
|
int skillID = (int)mob->data["m_iActiveSkill1"];
|
||||||
int targetData[5] = {1, mob->target->plr->iID, 0, 0, 0};
|
std::vector<int> targetData = {1, mob->target->plr->iID, 0, 0, 0};
|
||||||
for (auto& pwr : MobPowers)
|
for (auto& pwr : MobPowers)
|
||||||
if (pwr.skillType == NanoManager::SkillTable[skillID].skillType)
|
if (pwr.skillType == NanoManager::SkillTable[skillID].skillType)
|
||||||
pwr.handle(mob, targetData, skillID, NanoManager::SkillTable[skillID].durationTime[0], NanoManager::SkillTable[skillID].powerIntensity[0]);
|
pwr.handle(mob, targetData, skillID, NanoManager::SkillTable[skillID].durationTime[0], NanoManager::SkillTable[skillID].powerIntensity[0]);
|
||||||
@ -1563,7 +1563,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MobManager::dealCorruption(Mob *mob, int targetData[], int skillID, int style) {
|
void MobManager::dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int style) {
|
||||||
size_t resplen = sizeof(sP_FE2CL_NPC_SKILL_CORRUPTION_HIT) + targetData[0] * sizeof(sCAttackResult);
|
size_t resplen = sizeof(sP_FE2CL_NPC_SKILL_CORRUPTION_HIT) + targetData[0] * sizeof(sCAttackResult);
|
||||||
|
|
||||||
// validate response packet
|
// validate response packet
|
||||||
@ -1629,7 +1629,7 @@ void MobManager::dealCorruption(Mob *mob, int targetData[], int skillID, int sty
|
|||||||
if (plr->Nanos[plr->activeNano].iStamina > 150)
|
if (plr->Nanos[plr->activeNano].iStamina > 150)
|
||||||
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina = 150;
|
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina = 150;
|
||||||
// fire damage power disguised as a corruption attack back at the enemy
|
// fire damage power disguised as a corruption attack back at the enemy
|
||||||
int targetData2[5] = {1, mob->appearanceData.iNPC_ID, 0, 0, 0};
|
std::vector<int> targetData2 = {1, mob->appearanceData.iNPC_ID, 0, 0, 0};
|
||||||
for (auto& pwr : NanoManager::NanoPowers)
|
for (auto& pwr : NanoManager::NanoPowers)
|
||||||
if (pwr.skillType == EST_DAMAGE)
|
if (pwr.skillType == EST_DAMAGE)
|
||||||
pwr.handle(sock, targetData2, plr->activeNano, skillID, 0, 100);
|
pwr.handle(sock, targetData2, plr->activeNano, skillID, 0, 100);
|
||||||
@ -1850,7 +1850,7 @@ bool doBatteryDrain(Mob *mob, sSkillResult_BatteryDrain *respdata, int i, int32_
|
|||||||
|
|
||||||
template<class sPAYLOAD,
|
template<class sPAYLOAD,
|
||||||
bool (*work)(Mob*,sPAYLOAD*,int,int32_t,int32_t,int16_t,int16_t,int16_t)>
|
bool (*work)(Mob*,sPAYLOAD*,int,int32_t,int32_t,int16_t,int16_t,int16_t)>
|
||||||
void mobPower(Mob *mob, int targetData[],
|
void mobPower(Mob *mob, std::vector<int> targetData,
|
||||||
int16_t skillID, int16_t duration, int16_t amount,
|
int16_t skillID, int16_t duration, int16_t amount,
|
||||||
int16_t skillType, int32_t bitFlag, int16_t timeBuffID) {
|
int16_t skillType, int32_t bitFlag, int16_t timeBuffID) {
|
||||||
size_t resplen;
|
size_t resplen;
|
||||||
|
@ -123,7 +123,7 @@ struct Bullet {
|
|||||||
int bulletType;
|
int bulletType;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*MobPowerHandler)(Mob*, int*, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t);
|
typedef void (*MobPowerHandler)(Mob*, std::vector<int>, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t);
|
||||||
|
|
||||||
struct MobPower {
|
struct MobPower {
|
||||||
int16_t skillType;
|
int16_t skillType;
|
||||||
@ -133,7 +133,7 @@ struct MobPower {
|
|||||||
|
|
||||||
MobPower(int16_t s, int32_t b, int16_t t, MobPowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {}
|
MobPower(int16_t s, int32_t b, int16_t t, MobPowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {}
|
||||||
|
|
||||||
void handle(Mob *mob, int* targetData, int16_t skillID, int16_t duration, int16_t amount) {
|
void handle(Mob *mob, std::vector<int> targetData, int16_t skillID, int16_t duration, int16_t amount) {
|
||||||
if (handler == nullptr)
|
if (handler == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -189,5 +189,5 @@ namespace MobManager {
|
|||||||
|
|
||||||
void followToCombat(Mob *mob);
|
void followToCombat(Mob *mob);
|
||||||
void useAbilities(Mob *mob, time_t currTime);
|
void useAbilities(Mob *mob, time_t currTime);
|
||||||
void dealCorruption(Mob *mob, int *targetData, int skillID, int style);
|
void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int style);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user