-
-
Notifications
You must be signed in to change notification settings - Fork 110
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.
a851903106 08718f8
Merge branch 'Multi' of https://github.com/a851903106/StarBos into Multi
a851903106 685a81d
what?
a851903106 ee96284
oh test
a851903106 6aaceab
update doc again.
a851903106 1644f42
supplement the code.
a851903106 b0d1c9d
Merge branch 'develop' into Multi
a851903106 e8bee47
I should have been more careful.
a851903106 a6b1c21
Merge branch 'develop' into Multi
a851903106 0ec4836
Merge branch 'develop' into Multi
a851903106 0e4f8ac
Merge branch 'develop' into Multi
a851903106 39f0870
Merge branch 'develop' into Multi
a851903106 212dabc
update code.
a851903106 89b7bc0
handle merger conflicts.
a851903106 b7e75f9
delete the incorrect text
a851903106 8e80a1c
why is yrpp lacking parameters?
a851903106 b3e7f98
oh.
a851903106 b9b8996
another
a851903106 662cfaf
why, bro
a851903106 ed0b88f
fix something.
a851903106 c8a3b0f
did it fail to be generated?
a851903106 5da05e2
Merge branch 'Phobos-developers:develop' into Multi
a851903106 f889341
disable unlimited spawn.
a851903106 d3fb89d
fix an error
a851903106 9a1c260
separate code
a851903106 be09114
delete
a851903106 11315a3
and add
a851903106 343c68a
what?
a851903106 b2e9113
It's settled then!
DeathFishAtEase 534e2f4
Merge branch 'Phobos-developers:develop' into Multi
a851903106 fcd42df
Merge branch 'develop' into Multi
a851903106 3fd585a
Merge branch 'develop' into Multi
a851903106 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.