mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 22:11:04 +00:00
Compare commits
97 Commits
275f2183bf
...
b1613639f5
Author | SHA1 | Date | |
---|---|---|---|
|
b1613639f5 | ||
|
0eff236512 | ||
|
0fcf41cbfe | ||
|
efb3887e3e | ||
|
874bdefb13 | ||
|
94b08659d2 | ||
|
d936d0b621 | ||
|
249e5b081f | ||
|
52c1ed4480 | ||
|
522b9ab7b8 | ||
|
c0a9ec6b7c | ||
|
d416763ae0 | ||
|
ff74c8ede1 | ||
|
e64bcf91a5 | ||
|
b04c292272 | ||
|
36b6aeeb00 | ||
|
93ec6380c1 | ||
|
c1aff8d3c3 | ||
|
1cf2be9968 | ||
|
dd4063e416 | ||
|
464d18820b | ||
|
288a4a3da5 | ||
|
807e182407 | ||
|
0dd628717d | ||
|
c70205a15b | ||
|
8062e52c55 | ||
|
3b5f6c0fe7 | ||
|
e9cd5db8a2 | ||
|
e7450b974c | ||
|
13e71de785 | ||
|
e3c3da87b2 | ||
|
4bc53b2e7e | ||
|
03abb6f830 | ||
|
bd1abcef72 | ||
|
49fa6d65c4 | ||
|
773e4b36e1 | ||
|
945599f93c | ||
|
78c15e2899 | ||
|
eaebe3ba4c | ||
|
9312706524 | ||
|
80dd6b5479 | ||
|
751fd4fd9d | ||
|
ec71fd8f46 | ||
|
f0bb90b547 | ||
|
0dfcc928a9 | ||
|
dc6386131a | ||
|
9977907842 | ||
|
723e455b1d | ||
|
ab4b763f00 | ||
|
8b94bcd5ca | ||
|
1637b8e789 | ||
|
da38bbec29 | ||
|
a07f36e379 | ||
|
afc48b7676 | ||
|
15b6cd2fb4 | ||
|
34669eb7b9 | ||
|
ded7462677 | ||
|
704d6a2452 | ||
|
98634d5aa2 | ||
|
306a75f469 | ||
|
e4e4a421f4 | ||
|
2f612ce0e1 | ||
|
760170af94 | ||
|
2f4c8cdd60 | ||
|
c8f5aab929 | ||
|
9f74b7decb | ||
|
eea4107665 | ||
|
ad53ec82af | ||
|
22c93ac854 | ||
|
710300c04c | ||
|
04221f1c5f | ||
|
828f49cd62 | ||
|
4f49bcea87 | ||
|
f6094fde58 | ||
|
595dcda1b7 | ||
|
b6f15824f1 | ||
|
35e938b8c6 | ||
|
345c9cd3b2 | ||
|
68d53feea3 | ||
|
45742e90a2 | ||
|
69a478b777 | ||
|
c32e5b2d5e | ||
|
3d572432b3 | ||
|
0c4cdaeabf | ||
|
ed866fbee4 | ||
|
5ab0112298 | ||
4494ba5932 | |||
803073213e | |||
4153d5cd30 | |||
71f1f6edb9 | |||
|
32fad56d38 | ||
|
af7b99195f | ||
|
efc00e63b3 | ||
|
7ab01b098d | ||
|
32db574700 | ||
|
c965024d1c | ||
|
650f947451 |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
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,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`.
|
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,6 +127,7 @@ 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);
|
||||||
},
|
},
|
||||||
@ -150,19 +151,24 @@ 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 = (int)(skill->values[0][power] * scalingFactor);
|
int boostDrain = 0;
|
||||||
|
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;
|
||||||
|
|
||||||
int potionDrain = (int)(skill->values[1][power] * scalingFactor);
|
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 = target->hasBuff(ECSB_PROTECT_BATTERY);
|
result.bProtected = blocked;
|
||||||
result.iDrainW = boostDrain;
|
result.iDrainW = boostDrain;
|
||||||
result.iBatteryW = plr->batteryW;
|
result.iBatteryW = plr->batteryW;
|
||||||
result.iDrainN = potionDrain;
|
result.iDrainN = potionDrain;
|
||||||
@ -209,6 +215,11 @@ 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 style) {
|
static void dealCorruption(Mob *mob, std::vector<int> targetData, int skillID, int mobStyle) {
|
||||||
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 = style;
|
resp->iStyle = mobStyle;
|
||||||
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,27 +280,37 @@ 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 style2 = Nanos::nanoStyle(plr->activeNano);
|
int nanoStyle = Nanos::nanoStyle(plr->activeNano);
|
||||||
if (style2 == -1) { // no nano
|
if (nanoStyle == -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 (style == style2) {
|
} else if (mobStyle == nanoStyle) {
|
||||||
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 (style - style2 == 1 || style2 - style == 2) {
|
} else if (mobStyle - nanoStyle == 1 || nanoStyle - mobStyle == 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 = Abilities::SkillTable[skillID];
|
SkillData skill = {
|
||||||
skill.durationTime[0] = 0;
|
SkillType::DAMAGE, // skillType
|
||||||
skill.values[0][0] = 200; // have to set
|
SkillEffectTarget::POINT, // effectTarget
|
||||||
skill.values[0][1] = 200; // all of these
|
1, // effectType
|
||||||
skill.values[0][2] = 200; // because the player might
|
SkillTargetType::MOBS, // targetType
|
||||||
skill.values[0][3] = 200; // have a boost
|
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 });
|
Abilities::useNanoSkill(sock, &skill, *plr->getActiveNano(), { mob });
|
||||||
} else {
|
} else {
|
||||||
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;
|
respdata[i].iHitFlag = HF_BIT_STYLE_LOSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user