Compare commits

..

96 Commits

Author SHA1 Message Date
gsemaj
0eff236512
Fix corruption reflection 2023-08-19 16:19:36 -07:00
gsemaj
0fcf41cbfe
Fix guard FOR REAL 2023-08-19 15:03:16 -07:00
gsemaj
efb3887e3e
Fix corruption attack rebound 2023-08-19 14:54:18 -07:00
gsemaj
874bdefb13
Fix passive powers 2023-08-19 14:46:35 -07:00
gsemaj
94b08659d2
Fix battery drain block 2023-08-19 14:21:04 -07:00
gsemaj
d936d0b621 Updater contributer guide 2023-08-19 20:46:41 +00:00
gsemaj
249e5b081f Move corruption block to new system 2023-08-19 20:46:41 +00:00
gsemaj
52c1ed4480 Return home heal to new system 2023-08-19 20:46:41 +00:00
gsemaj
522b9ab7b8 Passive mob buffs to new system 2023-08-19 20:46:41 +00:00
gsemaj
c0a9ec6b7c Move mob active skills to new system 2023-08-19 20:46:41 +00:00
gsemaj
d416763ae0 Move eruption attacks to new system 2023-08-19 20:46:41 +00:00
gsemaj
ff74c8ede1 Implement leech 2023-08-19 20:46:41 +00:00
gsemaj
e64bcf91a5 Make clearBuffs memory-safe
improperly erasing during iteration oops
2023-08-19 20:46:41 +00:00
gsemaj
b04c292272 Break if player dies from buff combat tick 2023-08-19 20:46:41 +00:00
gsemaj
36b6aeeb00 Fix segv: Halt buff iteration if mob is dead 2023-08-19 20:46:41 +00:00
gsemaj
93ec6380c1 Tighten parameter for removeBuff 2023-08-19 20:46:41 +00:00
gsemaj
c1aff8d3c3 Move drain to new system
TODO
- There is a seg fault that happens when drain kills the mob
- leech unimplemented
- mob skills unimplemented
2023-08-19 20:46:41 +00:00
gsemaj
1cf2be9968 reorder some stuff 2023-08-19 20:46:41 +00:00
gsemaj
dd4063e416 Fix icon not disappearing for debuffs 2023-08-19 20:46:41 +00:00
gsemaj
464d18820b Tick buffs for mobs 2023-08-19 20:46:41 +00:00
gsemaj
288a4a3da5 Fix infinite slowdown with snare 2023-08-19 20:46:41 +00:00
gsemaj
807e182407 Implement buff handling for CombatNPC 2023-08-19 20:46:41 +00:00
gsemaj
0dd628717d Move buffs from Mob to CombatNPC 2023-08-19 20:46:41 +00:00
gsemaj
c70205a15b Implement buffs for mobs 2023-08-19 20:46:41 +00:00
gsemaj
8062e52c55 Damage n debuff handler 2023-08-19 20:46:41 +00:00
gsemaj
3b5f6c0fe7 Fix trailing structs
The change to allow flexible trailing struct sizes broke
`attachSkillResults` oops
2023-08-19 20:46:41 +00:00
gsemaj
e9cd5db8a2 Get rid of cbf 2023-08-19 20:46:41 +00:00
gsemaj
e7450b974c Add clearBuffs 2023-08-19 20:46:41 +00:00
gsemaj
13e71de785 Make skill result size check an assertion 2023-08-19 20:46:41 +00:00
gsemaj
e3c3da87b2 Oops 2023-08-19 20:46:41 +00:00
gsemaj
4bc53b2e7e Change SkillResult size validation
Since leech uses trailing structs of two different sizes, just use the max SkillResult size in validation/zeroing and then check for overflow in a couple extra places
2023-08-19 20:46:41 +00:00
gsemaj
03abb6f830 Reorder abilities to match client handling 2023-08-19 20:46:41 +00:00
gsemaj
bd1abcef72 Don't add buff if player dead 2023-08-19 20:46:41 +00:00
gsemaj
49fa6d65c4 Fix seg fault with egg powers 2023-08-19 20:46:41 +00:00
gsemaj
773e4b36e1 Reuse useNanoSkill codepath for passive powers 2023-08-19 20:46:41 +00:00
gsemaj
945599f93c Fix recall 2023-08-19 20:46:41 +00:00
gsemaj
78c15e2899 Make SkillType an enum class 2023-08-19 20:46:41 +00:00
gsemaj
eaebe3ba4c Fix self recall 2023-08-19 20:46:41 +00:00
gsemaj
9312706524 [WIP] Fix targeting for groups 2023-08-19 20:46:41 +00:00
gsemaj
80dd6b5479 [WIP] Active power handling
TODO:
- recall (self and group) is broken
- revive (only group) is broken
- damage + debuff is unimplemented
2023-08-19 20:46:41 +00:00
gsemaj
751fd4fd9d Sync with master 2023-08-19 20:46:41 +00:00
gsemaj
ec71fd8f46 Add overload to remove specific class of buff
I initially added this because, despite the higher tickrate for
composite condition calculations thanks to the last commit, there is
still a slight status icon delay when rapidly switching nanos. I
attempted to use this to make that problem go away and for whatever
reason it wasn't effective, but I figure it would be useful to have
anyway so I'm keeping it.
2023-08-19 20:46:41 +00:00
gsemaj
f0bb90b547 Move some stuff from playerTick to player combat step 2023-08-19 20:46:41 +00:00
gsemaj
0dfcc928a9 Refactor group handling 2023-08-19 20:46:41 +00:00
gsemaj
dc6386131a Port egg buffs over to new system 2023-08-19 20:46:41 +00:00
gsemaj
9977907842 More skill handlers
Note: need to revisit these when active powers are implemented to make
sure they are correct. DamageNDebuff isn't even implemented yet.
2023-08-19 20:46:41 +00:00
gsemaj
723e455b1d Passive nano powers 2023-08-19 20:46:41 +00:00
gsemaj
ab4b763f00 YET ANOTHER ITERATION of the new ability system
I am very tired
2023-08-19 20:46:41 +00:00
gsemaj
8b94bcd5ca Passive nano powers pt 1 2023-08-19 20:46:41 +00:00
gsemaj
1637b8e789 Passive nano powers boilerplate 2023-08-19 20:46:41 +00:00
gsemaj
da38bbec29 Fix timed out buffs not calling onExpire 2023-08-19 20:46:41 +00:00
gsemaj
a07f36e379 Buff framework tweaks + polish 2023-08-19 20:46:41 +00:00
gsemaj
afc48b7676 Rework buff callbacks
The first implementation was way too complicated and prone to bugs.
This is much more simple flexible; first off, std::function is now used
instead of a raw function pointer, so lambdas and binds are fair game
which is great for scripting. Second, callbacks for all stacks are
executed. It is up to the callback target to ensure correct behavior.
2023-08-19 20:46:41 +00:00
gsemaj
15b6cd2fb4 oops 2023-08-19 20:46:41 +00:00
gsemaj
34669eb7b9 CRLF purge in Buffs.cpp 2023-08-19 20:46:41 +00:00
gsemaj
ded7462677 egg prep 2023-08-19 20:46:41 +00:00
gsemaj
704d6a2452 Move Buff implementation to Buffs.cpp 2023-08-19 20:46:41 +00:00
gsemaj
98634d5aa2 New buff framework (player implementation)
Get rid of `iConditionBitFlag` in favor of a system of individual buff
objects that get composited to a bitflag on-the-fly.
Buff objects can have callbacks for application, expiration, and tick,
making them pretty flexible. Scripting languages can eventually use
these for custom behavior, too.

TODO:
- Get rid of bitflag in BaseNPC
- Apply buffs from passive nano powers
- Apply buffs from active nano powers
- Move eggs to new system
- ???
2023-08-19 20:46:41 +00:00
gsemaj
306a75f469 The great re-#include
Was getting frustrated by the inconsistency in our include statements,
which were causing me problems. As a result, I went through and manually
re-organized every include statement in non-core files.

I'm just gonna copy my rant from Discord:
FOR HEADER FILES (.hpp):
- everything you use IN THE HEADER must be EXPLICITLY INCLUDED with the exception of things that fall under Core.hpp
- you may NOT include ANYTHING ELSE

FOR SOURCE FILES (.cpp):
- you can #include whatever you want as long as the partner header is included first
- anything that gets included by another include is fair game
- redundant includes are ok because they'll be harmless AS LONG AS our header files stay lean.

the point of this is NOT to optimize the number of includes used all around or make things more efficient necessarily. it's to improve readability & coherence and make it easier to avoid cyclical issues
2023-08-19 20:46:41 +00:00
gsemaj
e4e4a421f4 Get rid of player fire rate suspicion
This was super primitive & jank, and caused false positives.
Will replace with a polished system later on.
2023-08-19 20:46:41 +00:00
gsemaj
2f612ce0e1 Handle case where cmake is invoked outside root 2023-08-19 20:46:41 +00:00
gsemaj
760170af94 Start moving passive power processing to playerTick 2023-08-19 20:46:41 +00:00
gsemaj
2f4c8cdd60 Groundwork for new buff system 2023-08-19 20:46:41 +00:00
gsemaj
c8f5aab929 Active power classification 2023-08-19 20:46:41 +00:00
gsemaj
9f74b7decb some struct reorg 2023-08-19 20:46:41 +00:00
gsemaj
eea4107665 Replace group filter operator with function 2023-08-19 20:46:41 +00:00
gsemaj
ad53ec82af Ignore .bak files
for my local backups lol
2023-08-19 20:46:41 +00:00
gsemaj
22c93ac854 Refactor player groups
Group structures are used now. Adds more checks in some places but simplifies things overall.
We can expand this system to entities as well now pretty trivially.
2023-08-19 20:46:41 +00:00
gsemaj
710300c04c (WIP) EXPERIMENTAL GROUP CHANGES 2023-08-19 20:46:41 +00:00
gsemaj
04221f1c5f (WIP) TODO ABILITIES 2023-08-19 20:46:41 +00:00
gsemaj
828f49cd62 Move mob aggro logic into takeDamage override
God that feels good
2023-08-19 20:46:41 +00:00
gsemaj
4f49bcea87 (WIP) Move away from rigid states/transitions to allow custom behavior 2023-08-19 20:46:41 +00:00
gsemaj
f6094fde58 EntityType -> EntityKind 2023-08-19 20:46:41 +00:00
gsemaj
595dcda1b7 (WIP) onRoamStart hook implementation 2023-08-19 20:46:41 +00:00
gsemaj
b6f15824f1 (WIP) Remove BaseNPC::barkerType to save space 2023-08-19 20:46:41 +00:00
gsemaj
35e938b8c6 ope 2023-08-19 20:46:41 +00:00
gsemaj
345c9cd3b2 (WIP) onCombatStart hook implementation 2023-08-19 20:46:41 +00:00
gsemaj
68d53feea3 (WIP) onDeath hook implementation 2023-08-19 20:46:41 +00:00
gsemaj
45742e90a2 (WIP) Add src param to transition + certain hooks
Should all hooks have src? I think not
2023-08-19 20:46:41 +00:00
gsemaj
69a478b777 (WIP) Transitions + hook definitions + onRetreat hook implementation 2023-08-19 20:46:41 +00:00
gsemaj
c32e5b2d5e (WIP) Point 2: Generalization 2023-08-19 20:46:41 +00:00
gsemaj
3d572432b3 (WIP) Point 1: step functions 2023-08-19 20:46:41 +00:00
gsemaj
0c4cdaeabf (WIP) Start implementing ICombatant
Start by replacing `hitMob` with `takeDamage` interface function.
Simplify `pcAttackChars` a little by utilizing the new interface, then add more interface functions as needed.

A lot of the combat logic is tied to the `Mob` class. Need to start moving stuff over to CombatNPC.
2023-08-19 20:46:41 +00:00
gsemaj
ed866fbee4 (WIP) Move ICombatant functions around a bit 2023-08-19 20:46:41 +00:00
gsemaj
5ab0112298 (WIP) Initial ICombatant draft 2023-08-19 20:46:41 +00:00
4494ba5932 [refactor] Get rid of NPC.hpp
This file was already obsoleted at the start of the refactor, but seems
to have escaped notice until now.
2023-08-19 20:46:41 +00:00
803073213e [refactor] Replace a few uses of magic numbers with enums 2023-08-19 20:46:41 +00:00
4153d5cd30 [refactor] Cosmetic cleanup in Fuse fight functions 2023-08-19 20:46:41 +00:00
71f1f6edb9 [refactor] Remove redundant coord args from most entity constructors
Mobs and CombatNPCs still need theirs in order to properly set their
roaming and spawn coords. Assignment of the latter has been moved to the
CombatNPC constructor, where it should have already been.
2023-08-19 20:46:41 +00:00
gsemaj
32fad56d38 [WIP] Stub power handler 2023-08-19 20:46:41 +00:00
gsemaj
af7b99195f [WIP] Use EntityRef instead of CNSocket in ability handler 2023-08-19 20:46:41 +00:00
gsemaj
efc00e63b3 [WIP] Replace appearance data with individual fields
Storing certain things in appearance data and others in their own fields
was gross. Now everything is stored on the same level and functions have
been added to generate appearance data when it's needed by the client.
2023-08-19 20:46:41 +00:00
gsemaj
7ab01b098d [WIP] Rename Entity.type -> Entity.kind 2023-08-19 20:46:41 +00:00
gsemaj
32db574700 [WIP] Fix Nanos -> Abilities namespace calls 2023-08-19 20:46:41 +00:00
gsemaj
c965024d1c [WIP] Initial merge of ability namespaces & features 2023-08-19 20:46:41 +00:00
gsemaj
650f947451 Add .dockerignore file
Fixes an issue where if you had a version.h file generated from cmake,
it would be used in the Dockerfile even though the container uses make.
2023-08-19 18:22:21 +00:00
4 changed files with 76 additions and 23 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
version.h

View File

@ -26,7 +26,7 @@ Both are pretty short reads and following them will get you up to speed with bra
I will now cover a few examples of the complications people have encountered contributing to this project, how to understand them, overcome them and henceforth avoid them.
## Dirty pull requests
### Dirty pull requests
Many Pull Requests OpenFusion receives fail to present a clean set of commits to merge.
These are generally either:
@ -44,7 +44,7 @@ If you read the above links, you'll note that this isn't exactly a perfect solut
The obvious issue, then, is that the people submitting dirty PRs are the exact people who don't *know* how to rebase their fork to continue submitting their work cleanly.
So they end up creating countless merge commits when pulling upstream on top of their own incompatible histories, and then submitting those merge commits in their PRs and the cycle continues.
## The details
### The details
A git commit is uniquely identified by its SHA1 hash.
Its hash is generated from its contents, as well as the hash(es) of its parent commit(s).
@ -52,7 +52,7 @@ Its hash is generated from its contents, as well as the hash(es) of its parent c
That means that even if two commits are exactly the same in terms of content, they're not the same commit if their parent commits differ (ex. if they've been rebased).
So if you keep issuing `git pull`s after upstream has merged a rebased version of your PR, you will never re-synchronize with it, and will instead construct an alternate history polluted by pointless merge commits.
## The solution
### The solution
If you already have a messed-up fork and you have no changes on it that you're afraid to lose, the solution is simple:
@ -67,7 +67,7 @@ If you do have some committed changes that haven't yet been merged upstream, you
If you do end up messing something up, don't worry, it most likely isn't really lost and `git reflog` is your friend.
(You can checkout an arbitrary commit, and make it into its own branch with `git checkout -b BRANCH` or set a pre-exisitng branch to it with `git reset --hard COMMIT`)
## Avoiding the problem
### Avoiding the problem
When working on a changeset you want to submit back upstream, don't do it on the main branch.
Create a work branch just for your changeset with `git checkout -b work`.
@ -81,3 +81,34 @@ That way you can always keep master in sync with upstream with `git pull --ff-on
Creating new branches for the rebase isn't strictly necessary since you can always return a branch to its previous state with `git reflog`.
For moving uncommited changes around between branches, `git stash` is a real blessing.
## Code guidelines
Alright, you're up to speed on Git and ready to go. Here are a few specific code guidelines to try and follow:
### Match the styling
Pretty straightforward, make sure your code looks similar to the code around it. Match whitespacing, bracket styling, variable naming conventions, etc.
### Prefer short-circuiting
To minimize branching complexity (as this makes the code hard to read), we prefer to keep the number of `if-else` statements as low as possible. One easy way to achieve this is by doing an early return after branching into an `if` block and then writing the code for the other path outside the block entirely. You can find examples of this in practically every source file. Note that in a few select situations, this might actually make your code less elegant, which is why this isn't a strict rule. Lean towards short-circuiting and use your better judgement.
### Follow the include convention
This one matters a lot as it can cause cyclic dependencies and other code-breaking issues.
FOR HEADER FILES (.hpp):
- everything you use IN THE HEADER must be EXPLICITLY INCLUDED with the exception of things that fall under Core.hpp
- you may NOT include ANYTHING ELSE
FOR SOURCE FILES (.cpp):
- you can #include whatever you want as long as the partner header is included first
- anything that gets included by another include is fair game
- redundant includes are ok because they'll be harmless AS LONG AS our header files stay lean.
The point of this is NOT to optimize the number of includes used all around or make things more efficient necessarily. it's to improve readability & coherence and make it easier to avoid cyclical issues.
## When in doubt, ask
If you still have questions that were not answered here, feel free to ping a dev in the Discord server or on GitHub.

View File

@ -127,6 +127,7 @@ static SkillResult handleSkillBuff(SkillData* skill, int power, ICombatant* sour
ICombatant* combatant = dynamic_cast<ICombatant*>(self.getEntity());
combatant->takeDamage(buff->getLastSource(), 0); // aggro
}
Buffs::timeBuffUpdate(self, buff, status, stack);
if(drainType == SkillDrainType::ACTIVE && status == ETBU_DEL)
Buffs::timeBuffTimeout(self);
},
@ -150,19 +151,24 @@ static SkillResult handleSkillBatteryDrain(SkillData* skill, int power, ICombata
Player* plr = dynamic_cast<Player*>(target);
const double scalingFactor = (18 + source->getLevel()) / 36.0;
const bool blocked = target->hasBuff(ECSB_PROTECT_BATTERY);
int boostDrain = (int)(skill->values[0][power] * scalingFactor);
if(boostDrain > plr->batteryW) boostDrain = plr->batteryW;
plr->batteryW -= boostDrain;
int boostDrain = 0;
int potionDrain = 0;
if(!blocked) {
boostDrain = (int)(skill->values[0][power] * scalingFactor);
if(boostDrain > plr->batteryW) boostDrain = plr->batteryW;
plr->batteryW -= boostDrain;
int potionDrain = (int)(skill->values[1][power] * scalingFactor);
if(potionDrain > plr->batteryN) potionDrain = plr->batteryN;
plr->batteryN -= potionDrain;
potionDrain = (int)(skill->values[1][power] * scalingFactor);
if(potionDrain > plr->batteryN) potionDrain = plr->batteryN;
plr->batteryN -= potionDrain;
}
sSkillResult_BatteryDrain result{};
result.eCT = target->getCharType();
result.iID = target->getID();
result.bProtected = target->hasBuff(ECSB_PROTECT_BATTERY);
result.bProtected = blocked;
result.iDrainW = boostDrain;
result.iBatteryW = plr->batteryW;
result.iDrainN = potionDrain;
@ -209,6 +215,11 @@ static std::vector<SkillResult> handleSkill(SkillData* skill, int power, ICombat
switch(skill->skillType)
{
case SkillType::CORRUPTIONATTACK:
case SkillType::CORRUPTIONATTACKLOSE:
case SkillType::CORRUPTIONATTACKWIN:
// skillHandler = handleSkillCorruptionReflect;
// break;
case SkillType::DAMAGE:
skillHandler = handleSkillDamage;
break;

View File

@ -227,7 +227,7 @@ bool MobAI::aggroCheck(Mob *mob, time_t currTime) {
return false;
}
static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int style) {
static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int mobStyle) {
Player *plr = PlayerManager::getPlayer(mob->target);
size_t resplen = sizeof(sP_FE2CL_NPC_SKILL_CORRUPTION_HIT) + targetData[0] * sizeof(sCAttackResult);
@ -246,7 +246,7 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
resp->iNPC_ID = mob->id;
resp->iSkillID = skillID;
resp->iStyle = style;
resp->iStyle = mobStyle;
resp->iValue1 = plr->x;
resp->iValue2 = plr->y;
resp->iValue3 = plr->z;
@ -280,27 +280,37 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
respdata[i].iActiveNanoSlotNum = n;
respdata[i].iNanoID = plr->activeNano;
int style2 = Nanos::nanoStyle(plr->activeNano);
if (style2 == -1) { // no nano
int nanoStyle = Nanos::nanoStyle(plr->activeNano);
if (nanoStyle == -1) { // no nano
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
respdata[i].iDamage = Abilities::SkillTable[skillID].values[0][0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
} else if (style == style2) {
} else if (mobStyle == nanoStyle) {
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
respdata[i].iDamage = 0;
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina;
} else if (style - style2 == 1 || style2 - style == 2) {
} else if (mobStyle - nanoStyle == 1 || nanoStyle - mobStyle == 2) {
respdata[i].iHitFlag = HF_BIT_STYLE_WIN;
respdata[i].iDamage = 0;
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina += 45;
if (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
SkillData skill = Abilities::SkillTable[skillID];
skill.durationTime[0] = 0;
skill.values[0][0] = 200; // have to set
skill.values[0][1] = 200; // all of these
skill.values[0][2] = 200; // because the player might
skill.values[0][3] = 200; // have a boost
SkillData skill = {
SkillType::DAMAGE, // skillType
SkillEffectTarget::POINT, // effectTarget
1, // effectType
SkillTargetType::MOBS, // targetType
SkillDrainType::ACTIVE, // drainType
0, // effectArea
{0, 0, 0, 0}, // batteryUse
{0, 0, 0, 0}, // durationTime
{0, 0, 0}, // valueTypes (unused)
{
{200, 200, 200, 200},
{200, 200, 200, 200},
{200, 200, 200, 200},
}
};
Abilities::useNanoSkill(sock, &skill, *plr->getActiveNano(), { mob });
} else {
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;