-
-
Notifications
You must be signed in to change notification settings - Fork 116
MultiWeapon #1630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
MultiWeapon #1630
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b39fac3
update code.
Fly-Star-him 08718f8
Merge branch 'Multi' of https://github.com/a851903106/StarBos into Multi
Fly-Star-him 685a81d
what?
Fly-Star-him ee96284
oh test
Fly-Star-him 6aaceab
update doc again.
Fly-Star-him 1644f42
supplement the code.
Fly-Star-him b0d1c9d
Merge branch 'develop' into Multi
Fly-Star-him e8bee47
I should have been more careful.
Fly-Star-him a6b1c21
Merge branch 'develop' into Multi
Fly-Star-him 0ec4836
Merge branch 'develop' into Multi
Fly-Star-him 0e4f8ac
Merge branch 'develop' into Multi
Fly-Star-him 39f0870
Merge branch 'develop' into Multi
Fly-Star-him 212dabc
update code.
Fly-Star-him 89b7bc0
handle merger conflicts.
Fly-Star-him b7e75f9
delete the incorrect text
Fly-Star-him 8e80a1c
why is yrpp lacking parameters?
Fly-Star-him b3e7f98
oh.
Fly-Star-him b9b8996
another
Fly-Star-him 662cfaf
why, bro
Fly-Star-him ed0b88f
fix something.
Fly-Star-him c8a3b0f
did it fail to be generated?
Fly-Star-him 5da05e2
Merge branch 'Phobos-developers:develop' into Multi
Fly-Star-him f889341
disable unlimited spawn.
Fly-Star-him d3fb89d
fix an error
Fly-Star-him 9a1c260
separate code
Fly-Star-him be09114
delete
Fly-Star-him 11315a3
and add
Fly-Star-him 343c68a
what?
Fly-Star-him b2e9113
It's settled then!
DeathFishAtEase 534e2f4
Merge branch 'Phobos-developers:develop' into Multi
Fly-Star-him fcd42df
Merge branch 'develop' into Multi
Fly-Star-him 3fd585a
Merge branch 'develop' into Multi
Fly-Star-him File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#include "Body.h" | ||
|
||
#include <InfantryClass.h> | ||
#include <HouseClass.h> | ||
#include <OverlayTypeClass.h> | ||
#include <TerrainClass.h> | ||
#include <SpawnManagerClass.h> | ||
#include <SlaveManagerClass.h> | ||
#include <AirstrikeClass.h> | ||
#include <Kamikaze.h> | ||
|
||
#include <Ext/BulletType/Body.h> | ||
#include <Ext/WeaponType/Body.h> | ||
#include <Utilities/GeneralUtils.h> | ||
#include <Utilities/EnumFunctions.h> | ||
|
||
bool TechnoExt::CheckMultiWeapon(TechnoClass* const pThis, AbstractClass* const pTarget, WeaponTypeClass* const pWeaponType) | ||
{ | ||
if (!pThis || !pTarget) | ||
return false; | ||
|
||
if (!pWeaponType || pWeaponType->NeverUse) | ||
return false; | ||
|
||
if (pThis->InOpenToppedTransport && !pWeaponType->FireInTransport) | ||
return false; | ||
|
||
const auto pBulletType = pWeaponType->Projectile; | ||
const auto pWhatAmI = pTarget->WhatAmI(); | ||
const bool isBuilding = pWhatAmI != AbstractType::Building; | ||
const auto pWH = pWeaponType->Warhead; | ||
const auto pOwner = pThis->Owner; | ||
|
||
if (pTarget->IsInAir()) | ||
{ | ||
if (!pBulletType->AA) | ||
return false; | ||
|
||
if (pWH->Airstrike) | ||
return false; | ||
} | ||
else | ||
{ | ||
const auto pBulletTypeExt = BulletTypeExt::ExtMap.Find(pBulletType); | ||
|
||
if (pBulletTypeExt->AAOnly.Get()) | ||
{ | ||
return false; | ||
} | ||
else if(pWH->ElectricAssault) | ||
{ | ||
if (isBuilding) | ||
return false; | ||
|
||
const auto pBuilding = static_cast<BuildingClass*>(pTarget); | ||
|
||
if (!pOwner->IsAlliedWith(pBuilding->Owner) || | ||
!pBuilding->Type || !pBuilding->Type->Overpowerable) | ||
return false; | ||
Coronia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
else if (pWH->IsLocomotor) | ||
{ | ||
if (isBuilding) | ||
return false; | ||
} | ||
} | ||
|
||
if (pTarget->AbstractFlags & AbstractFlags::Techno) | ||
{ | ||
TechnoClass* pTechno = static_cast<TechnoClass*>(pTarget); | ||
|
||
if (pTechno->Health <= 0 || !pTechno->IsAlive) | ||
return false; | ||
|
||
if (pTechno->AttachedBomb) | ||
{ | ||
if (pWH->IvanBomb) | ||
return false; | ||
} | ||
else if (pWH->BombDisarm) | ||
{ | ||
return false; | ||
} | ||
|
||
const auto pTechnoType = pTechno->GetTechnoType(); | ||
|
||
if (pWH->MindControl && (pTechnoType->ImmuneToPsionics || | ||
pTechno->IsMindControlled() || pOwner == pTechno->Owner)) | ||
return false; | ||
Coronia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (pWH->Parasite && (isBuilding || | ||
static_cast<FootClass*>(pTechno)->ParasiteEatingMe)) | ||
return false; | ||
|
||
if (!pWH->Temporal && pTechno->BeingWarpedOut) | ||
return false; | ||
|
||
Coronia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (pWeaponType->DrainWeapon && (!pTechnoType->Drainable || | ||
(pTechno->DrainingMe || pOwner->IsAlliedWith(pTechno->Owner)))) | ||
return false; | ||
|
||
if (const auto pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeaponType)) | ||
{ | ||
if (!pWeaponExt->HasRequiredAttachedEffects(pTechno, pThis)) | ||
return false; | ||
} | ||
|
||
const auto pTargetExt = TechnoExt::ExtMap.Find(pTechno); | ||
const auto pShield = pTargetExt->Shield.get(); | ||
|
||
if (pShield && pShield->IsActive() && | ||
!pShield->CanBeTargeted(pWeaponType)) | ||
{ | ||
return false; | ||
} | ||
else if (GeneralUtils::GetWarheadVersusArmor(pWH, pTechno->GetTechnoType()->Armor) == 0.0) | ||
{ | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
if (pWhatAmI == AbstractType::Terrain) | ||
{ | ||
if (!pWH->Wood) | ||
return false; | ||
} | ||
else if (pWhatAmI == AbstractType::Cell) | ||
{ | ||
const auto pCell = static_cast<CellClass*>(pTarget); | ||
|
||
if (pCell && pCell->OverlayTypeIndex >= 0) | ||
{ | ||
auto overlayType = OverlayTypeClass::Array.GetItem(pCell->OverlayTypeIndex); | ||
|
||
if (overlayType->Wall && !pWH->Wall) | ||
return false; | ||
} | ||
Coronia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
return true; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.