mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-16 19:20:05 +00:00
Passive nano powers pt 1
This commit is contained in:
parent
1637b8e789
commit
8b94bcd5ca
@ -40,71 +40,71 @@ std::vector<EntityRef> Abilities::matchTargets(SkillData* skill, int count, int3
|
||||
return targets;
|
||||
}
|
||||
|
||||
/* ripped from client */
|
||||
/* ripped from client (enums emplaced) */
|
||||
int Abilities::getCSTBFromST(int eSkillType) {
|
||||
int result = 0;
|
||||
switch (eSkillType)
|
||||
{
|
||||
case 11:
|
||||
result = 1;
|
||||
case EST_RUN:
|
||||
result = ECSB_UP_MOVE_SPEED;
|
||||
break;
|
||||
case 10:
|
||||
result = 3;
|
||||
case EST_JUMP:
|
||||
result = ECSB_UP_JUMP_HEIGHT;
|
||||
break;
|
||||
case 12:
|
||||
result = 4;
|
||||
case EST_STEALTH:
|
||||
result = ECSB_UP_STEALTH;
|
||||
break;
|
||||
case 16:
|
||||
result = 5;
|
||||
case EST_PHOENIX:
|
||||
result = ECSB_PHOENIX;
|
||||
break;
|
||||
case 17:
|
||||
result = 6;
|
||||
case EST_PROTECTBATTERY:
|
||||
result = ECSB_PROTECT_BATTERY;
|
||||
break;
|
||||
case 18:
|
||||
result = 7;
|
||||
case EST_PROTECTINFECTION:
|
||||
result = ECSB_PROTECT_INFECTION;
|
||||
break;
|
||||
case 5:
|
||||
result = 8;
|
||||
case EST_SNARE:
|
||||
result = ECSB_DN_MOVE_SPEED;
|
||||
break;
|
||||
case 4:
|
||||
result = 11;
|
||||
case EST_SLEEP:
|
||||
result = ECSB_MEZ;
|
||||
break;
|
||||
case 14:
|
||||
result = 13;
|
||||
case EST_MINIMAPENEMY:
|
||||
result = ECSB_MINIMAP_ENEMY;
|
||||
break;
|
||||
case 15:
|
||||
result = 14;
|
||||
case EST_MINIMAPTRESURE:
|
||||
result = ECSB_MINIMAP_TRESURE;
|
||||
break;
|
||||
case 19:
|
||||
result = 15;
|
||||
case EST_REWARDBLOB:
|
||||
result = ECSB_REWARD_BLOB;
|
||||
break;
|
||||
case 20:
|
||||
result = 16;
|
||||
case EST_REWARDCASH:
|
||||
result = ECSB_REWARD_CASH;
|
||||
break;
|
||||
case 23:
|
||||
result = 17;
|
||||
case EST_INFECTIONDAMAGE:
|
||||
result = ECSB_INFECTION;
|
||||
break;
|
||||
case 25:
|
||||
result = 18;
|
||||
case EST_FREEDOM:
|
||||
result = ECSB_FREEDOM;
|
||||
break;
|
||||
case 31:
|
||||
result = 19;
|
||||
case EST_BOUNDINGBALL:
|
||||
result = ECSB_BOUNDINGBALL;
|
||||
break;
|
||||
case 32:
|
||||
result = 20;
|
||||
case EST_INVULNERABLE:
|
||||
result = ECSB_INVULNERABLE;
|
||||
break;
|
||||
case 35:
|
||||
result = 24;
|
||||
case EST_BUFFHEAL:
|
||||
result = ECSB_HEAL;
|
||||
break;
|
||||
case 33:
|
||||
result = 21;
|
||||
case EST_NANOSTIMPAK:
|
||||
result = ECSB_STIMPAKSLOT1;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma region Skill Handlers
|
||||
void Abilities::usePassiveNanoSkill(SkillData* skill, Player* plr) {
|
||||
void Abilities::usePassiveNanoSkill(SkillData* skill, Player* plr, int boost) {
|
||||
assert(skill->drainType == SkillDrainType::PASSIVE);
|
||||
|
||||
EntityRef self = PlayerManager::getSockFromID(plr->iID);
|
||||
@ -118,12 +118,17 @@ void Abilities::usePassiveNanoSkill(SkillData* skill, Player* plr) {
|
||||
std::cout << "[WARN] Passive skill with type " << skill->skillType << " has target type MOB" << std::endl;
|
||||
}
|
||||
|
||||
int timeBuffId = getCSTBFromST(skill->skillType);
|
||||
int value = skill->values[0][boost];
|
||||
|
||||
BuffStack passiveBuff = {
|
||||
1, // passive nano buffs refreshed every tick
|
||||
value,
|
||||
self,
|
||||
BuffClass::NONE, // overwritten per target
|
||||
[](EntityRef host, BuffStack* stack) {
|
||||
Buffs::timeBuffUpdate(host, stack, ETBU_ADD);
|
||||
// TODO SKILLUSE/SKILLUSESUCC, sSkillResult_Buff
|
||||
},
|
||||
nullptr,
|
||||
[](EntityRef host, BuffStack* stack) {
|
||||
@ -138,7 +143,7 @@ void Abilities::usePassiveNanoSkill(SkillData* skill, Player* plr) {
|
||||
|
||||
passiveBuff.buffStackClass = target == self ? BuffClass::NANO : BuffClass::GROUP_NANO;
|
||||
ICombatant* combatant = dynamic_cast<ICombatant*>(entity);
|
||||
combatant->addBuff(getCSTBFromST(skill->skillType), &passiveBuff);
|
||||
combatant->addBuff(timeBuffId, &passiveBuff);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
@ -47,7 +47,7 @@ namespace Abilities {
|
||||
std::vector<EntityRef> matchTargets(SkillData*, int, int32_t*);
|
||||
int getCSTBFromST(int eSkillType);
|
||||
|
||||
void usePassiveNanoSkill(SkillData*, Player*);
|
||||
void usePassiveNanoSkill(SkillData*, Player*, int);
|
||||
|
||||
void init();
|
||||
}
|
||||
|
@ -73,14 +73,21 @@ void Buffs::timeBuffUpdate(EntityRef self, BuffStack* stack, int status) {
|
||||
if(status == ETBU_DEL && plr->hasBuff(stack->buff->id))
|
||||
return; // no premature status removal!
|
||||
|
||||
sTimeBuff payload{};
|
||||
|
||||
int cbf = plr->getCompositeCondition();
|
||||
if(status == ETBU_ADD && stack->buff->id > 0) cbf |= CSB_FROM_ECSB(stack->buff->id);
|
||||
if(status == ETBU_ADD) {
|
||||
if(stack->buff->id > 0) cbf |= CSB_FROM_ECSB(stack->buff->id);
|
||||
payload.iValue = stack->value;
|
||||
//payload.iTimeLimit = stack->durationTicks * MS_PER_PLAYER_TICK;
|
||||
}
|
||||
|
||||
INITSTRUCT(sP_FE2CL_PC_BUFF_UPDATE, pkt);
|
||||
pkt.eCSTB = stack->buff->id; // eCharStatusTimeBuffID
|
||||
pkt.eTBU = status; // eTimeBuffUpdate
|
||||
pkt.eTBT = (int)stack->buffStackClass;
|
||||
pkt.iConditionBitFlag = cbf;
|
||||
pkt.TimeBuff = payload;
|
||||
self.sock->sendPacket((void*)&pkt, P_FE2CL_PC_BUFF_UPDATE, sizeof(sP_FE2CL_PC_BUFF_UPDATE));
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ typedef std::function<void(EntityRef, BuffStack*)> BuffCallback;
|
||||
|
||||
struct BuffStack {
|
||||
int durationTicks;
|
||||
int value;
|
||||
EntityRef source;
|
||||
BuffClass buffStackClass;
|
||||
|
||||
|
@ -380,6 +380,7 @@ static void dotDamageOnOff(CNSocket *sock, CNPacketData *data) {
|
||||
if (pkt->iFlag && !plr->hasBuff(ECSB_INFECTION)) {
|
||||
BuffStack infection = {
|
||||
-1, // infinite
|
||||
NULL,
|
||||
sock, // self-inflicted
|
||||
BuffClass::ENVIRONMENT,
|
||||
[](EntityRef host, BuffStack* stack) {
|
||||
@ -775,7 +776,7 @@ static void playerTick(CNServer *serv, time_t currTime) {
|
||||
if (skill->drainType == SkillDrainType::PASSIVE) {
|
||||
// apply passive buff
|
||||
drainRate = skill->batteryUse[boost * 3];
|
||||
Abilities::usePassiveNanoSkill(skill, plr);
|
||||
Abilities::usePassiveNanoSkill(skill, plr, boost * 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,6 +494,7 @@ static void itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
||||
int durationMilliseconds = Abilities::SkillTable[144].durationTime[0] * 100;
|
||||
BuffStack gumballBuff = {
|
||||
durationMilliseconds / MS_PER_PLAYER_TICK,
|
||||
NULL,
|
||||
sock,
|
||||
BuffClass::CASH_ITEM, // or BuffClass::ITEM?
|
||||
[](EntityRef host, BuffStack* stack) {
|
||||
|
Loading…
Reference in New Issue
Block a user