mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-07-04 17:30:07 +00:00
Compare commits
89 Commits
0eff236512
...
ae9ee6094d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ae9ee6094d | ||
![]() |
6d5cea0d9a | ||
![]() |
fdd7d53aed | ||
![]() |
57f8f3e0e1 | ||
![]() |
a3008cab3c | ||
![]() |
02fd17c0e7 | ||
![]() |
da33c5c30f | ||
![]() |
478ae3d996 | ||
![]() |
9affe76587 | ||
![]() |
33fde8af69 | ||
![]() |
1a7bb826d8 | ||
![]() |
da9fb499de | ||
![]() |
2bc2235179 | ||
![]() |
618126f963 | ||
![]() |
b16ffe4f19 | ||
![]() |
6edc01c1f1 | ||
![]() |
c0e566050b | ||
![]() |
7a59248ace | ||
![]() |
6ee55d7406 | ||
![]() |
41622ad8aa | ||
![]() |
0f09808bc4 | ||
![]() |
b6171ebdc1 | ||
![]() |
5671adbd74 | ||
![]() |
550b26db39 | ||
![]() |
68be9cc381 | ||
![]() |
ef33a182d1 | ||
![]() |
9bd8eabed7 | ||
![]() |
2249b5381b | ||
![]() |
9b7656117d | ||
![]() |
9394825d41 | ||
![]() |
6e0d55c4b7 | ||
![]() |
33396f8d28 | ||
![]() |
cd908666af | ||
![]() |
74588f2c77 | ||
![]() |
829f75112c | ||
![]() |
343668fbcd | ||
![]() |
2e572169c0 | ||
![]() |
b3e28ddea3 | ||
![]() |
1670dfd830 | ||
![]() |
e768ebcabe | ||
![]() |
9bc7e8de62 | ||
![]() |
f249599ab5 | ||
![]() |
2901f5f285 | ||
![]() |
36f329c302 | ||
![]() |
eb7daf8eaa | ||
![]() |
0c5a9400ce | ||
![]() |
f150595f70 | ||
![]() |
c6528eb2ac | ||
![]() |
d631ca1aa1 | ||
![]() |
a94fb0ed6d | ||
![]() |
d48aa21135 | ||
![]() |
c60c4dac38 | ||
![]() |
215da0130d | ||
![]() |
0e8a4742eb | ||
![]() |
85bb4d163e | ||
![]() |
09b74a5711 | ||
![]() |
90819bea8e | ||
![]() |
3cc5c09a91 | ||
![]() |
536d5fbcfa | ||
![]() |
4ec3a3acb7 | ||
![]() |
89ed0b99a3 | ||
![]() |
db73b85bc8 | ||
![]() |
6cab203401 | ||
![]() |
92846e0eac | ||
![]() |
5963ea06be | ||
![]() |
c28970f2e1 | ||
![]() |
8be853c2dc | ||
![]() |
a811e73fed | ||
![]() |
a58971c270 | ||
![]() |
07429a0e51 | ||
![]() |
7c9038cf10 | ||
![]() |
c1e391d86a | ||
![]() |
e23af08838 | ||
![]() |
8a26ae2f01 | ||
![]() |
d17694e12e | ||
![]() |
4b612f35d2 | ||
![]() |
d9e0a4a281 | ||
![]() |
dd9891f668 | ||
![]() |
962141e54f | ||
bea41132b4 | |||
f305d7252d | |||
ff62129eec | |||
55f3ab8bad | |||
![]() |
a732cde117 | ||
![]() |
703eaff2b4 | ||
![]() |
f4f5f2e0bd | ||
![]() |
1858938280 | ||
![]() |
0af8f7e91d | ||
![]() |
168a85e8ff |
@ -1 +0,0 @@
|
|||||||
version.h
|
|
@ -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.
|
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.
|
Many Pull Requests OpenFusion receives fail to present a clean set of commits to merge.
|
||||||
These are generally either:
|
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.
|
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.
|
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.
|
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).
|
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).
|
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.
|
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:
|
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.
|
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`)
|
(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.
|
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`.
|
Create a work branch just for your changeset with `git checkout -b work`.
|
||||||
@ -81,34 +81,3 @@ 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`.
|
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.
|
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.
|
|
||||||
|
@ -127,7 +127,6 @@ static SkillResult handleSkillBuff(SkillData* skill, int power, ICombatant* sour
|
|||||||
ICombatant* combatant = dynamic_cast<ICombatant*>(self.getEntity());
|
ICombatant* combatant = dynamic_cast<ICombatant*>(self.getEntity());
|
||||||
combatant->takeDamage(buff->getLastSource(), 0); // aggro
|
combatant->takeDamage(buff->getLastSource(), 0); // aggro
|
||||||
}
|
}
|
||||||
Buffs::timeBuffUpdate(self, buff, status, stack);
|
|
||||||
if(drainType == SkillDrainType::ACTIVE && status == ETBU_DEL)
|
if(drainType == SkillDrainType::ACTIVE && status == ETBU_DEL)
|
||||||
Buffs::timeBuffTimeout(self);
|
Buffs::timeBuffTimeout(self);
|
||||||
},
|
},
|
||||||
@ -151,24 +150,19 @@ static SkillResult handleSkillBatteryDrain(SkillData* skill, int power, ICombata
|
|||||||
Player* plr = dynamic_cast<Player*>(target);
|
Player* plr = dynamic_cast<Player*>(target);
|
||||||
|
|
||||||
const double scalingFactor = (18 + source->getLevel()) / 36.0;
|
const double scalingFactor = (18 + source->getLevel()) / 36.0;
|
||||||
const bool blocked = target->hasBuff(ECSB_PROTECT_BATTERY);
|
|
||||||
|
|
||||||
int boostDrain = 0;
|
int boostDrain = (int)(skill->values[0][power] * scalingFactor);
|
||||||
int potionDrain = 0;
|
|
||||||
if(!blocked) {
|
|
||||||
boostDrain = (int)(skill->values[0][power] * scalingFactor);
|
|
||||||
if(boostDrain > plr->batteryW) boostDrain = plr->batteryW;
|
if(boostDrain > plr->batteryW) boostDrain = plr->batteryW;
|
||||||
plr->batteryW -= boostDrain;
|
plr->batteryW -= boostDrain;
|
||||||
|
|
||||||
potionDrain = (int)(skill->values[1][power] * scalingFactor);
|
int potionDrain = (int)(skill->values[1][power] * scalingFactor);
|
||||||
if(potionDrain > plr->batteryN) potionDrain = plr->batteryN;
|
if(potionDrain > plr->batteryN) potionDrain = plr->batteryN;
|
||||||
plr->batteryN -= potionDrain;
|
plr->batteryN -= potionDrain;
|
||||||
}
|
|
||||||
|
|
||||||
sSkillResult_BatteryDrain result{};
|
sSkillResult_BatteryDrain result{};
|
||||||
result.eCT = target->getCharType();
|
result.eCT = target->getCharType();
|
||||||
result.iID = target->getID();
|
result.iID = target->getID();
|
||||||
result.bProtected = blocked;
|
result.bProtected = target->hasBuff(ECSB_PROTECT_BATTERY);
|
||||||
result.iDrainW = boostDrain;
|
result.iDrainW = boostDrain;
|
||||||
result.iBatteryW = plr->batteryW;
|
result.iBatteryW = plr->batteryW;
|
||||||
result.iDrainN = potionDrain;
|
result.iDrainN = potionDrain;
|
||||||
@ -215,11 +209,6 @@ static std::vector<SkillResult> handleSkill(SkillData* skill, int power, ICombat
|
|||||||
|
|
||||||
switch(skill->skillType)
|
switch(skill->skillType)
|
||||||
{
|
{
|
||||||
case SkillType::CORRUPTIONATTACK:
|
|
||||||
case SkillType::CORRUPTIONATTACKLOSE:
|
|
||||||
case SkillType::CORRUPTIONATTACKWIN:
|
|
||||||
// skillHandler = handleSkillCorruptionReflect;
|
|
||||||
// break;
|
|
||||||
case SkillType::DAMAGE:
|
case SkillType::DAMAGE:
|
||||||
skillHandler = handleSkillDamage;
|
skillHandler = handleSkillDamage;
|
||||||
break;
|
break;
|
||||||
|
@ -227,7 +227,7 @@ bool MobAI::aggroCheck(Mob *mob, time_t currTime) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int mobStyle) {
|
static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int style) {
|
||||||
Player *plr = PlayerManager::getPlayer(mob->target);
|
Player *plr = PlayerManager::getPlayer(mob->target);
|
||||||
|
|
||||||
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);
|
||||||
@ -246,7 +246,7 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
|
|||||||
|
|
||||||
resp->iNPC_ID = mob->id;
|
resp->iNPC_ID = mob->id;
|
||||||
resp->iSkillID = skillID;
|
resp->iSkillID = skillID;
|
||||||
resp->iStyle = mobStyle;
|
resp->iStyle = style;
|
||||||
resp->iValue1 = plr->x;
|
resp->iValue1 = plr->x;
|
||||||
resp->iValue2 = plr->y;
|
resp->iValue2 = plr->y;
|
||||||
resp->iValue3 = plr->z;
|
resp->iValue3 = plr->z;
|
||||||
@ -280,37 +280,27 @@ static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, i
|
|||||||
respdata[i].iActiveNanoSlotNum = n;
|
respdata[i].iActiveNanoSlotNum = n;
|
||||||
respdata[i].iNanoID = plr->activeNano;
|
respdata[i].iNanoID = plr->activeNano;
|
||||||
|
|
||||||
int nanoStyle = Nanos::nanoStyle(plr->activeNano);
|
int style2 = Nanos::nanoStyle(plr->activeNano);
|
||||||
if (nanoStyle == -1) { // no nano
|
if (style2 == -1) { // no nano
|
||||||
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
||||||
respdata[i].iDamage = Abilities::SkillTable[skillID].values[0][0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
respdata[i].iDamage = Abilities::SkillTable[skillID].values[0][0] * PC_MAXHEALTH((int)mob->data["m_iNpcLevel"]) / 1500;
|
||||||
} else if (mobStyle == nanoStyle) {
|
} else if (style == style2) {
|
||||||
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
respdata[i].iHitFlag = HF_BIT_STYLE_TIE;
|
||||||
respdata[i].iDamage = 0;
|
respdata[i].iDamage = 0;
|
||||||
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina;
|
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina;
|
||||||
} else if (mobStyle - nanoStyle == 1 || nanoStyle - mobStyle == 2) {
|
} else if (style - style2 == 1 || style2 - style == 2) {
|
||||||
respdata[i].iHitFlag = HF_BIT_STYLE_WIN;
|
respdata[i].iHitFlag = HF_BIT_STYLE_WIN;
|
||||||
respdata[i].iDamage = 0;
|
respdata[i].iDamage = 0;
|
||||||
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina += 45;
|
respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina += 45;
|
||||||
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
|
||||||
SkillData skill = {
|
SkillData skill = Abilities::SkillTable[skillID];
|
||||||
SkillType::DAMAGE, // skillType
|
skill.durationTime[0] = 0;
|
||||||
SkillEffectTarget::POINT, // effectTarget
|
skill.values[0][0] = 200; // have to set
|
||||||
1, // effectType
|
skill.values[0][1] = 200; // all of these
|
||||||
SkillTargetType::MOBS, // targetType
|
skill.values[0][2] = 200; // because the player might
|
||||||
SkillDrainType::ACTIVE, // drainType
|
skill.values[0][3] = 200; // have a boost
|
||||||
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 });
|
Abilities::useNanoSkill(sock, &skill, *plr->getActiveNano(), { mob });
|
||||||
} else {
|
} else {
|
||||||
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;
|
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user