Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ This page lists all the individual contributions to the project by their author.
- Warhead activation target health thresholds enhancements
- Event 606: AttachEffect is attaching to a Techno
- Linked superweapons
- Modify Ammo on impact
- **Starkku**:
- Misc. minor bugfixes & improvements
- AI script actions:
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 4 files
+1 −1 HouseTypeClass.h
+1 −1 RulesClass.h
+1 −1 SessionClass.h
+1 −1 YRCom.h
10 changes: 10 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,16 @@ LaunchSW.DisplayMoney.Houses=all ; Affected House Enumeration (none|owner/self|
LaunchSW.DisplayMoney.Offset=0,0 ; X,Y, pixels relative to default
```

### Modify Ammo on impact

- Warheads can now modify ammo of the affected objects.

In `rulesmd.ini`:
```ini
[SOMEWARHEAD] ; Warhead
Ammo=0 ; integer
```

### Parasite removal

- By default if unit takes negative damage from a Warhead (before `Verses` are calculated), any parasites infecting it are removed and deleted. This behaviour can now be customized to disable the removal for negative damage, or enable it for any arbitrary warhead.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ New:
- Draw visual effects for airburst weapons (by CrimRecya)
- Unit `Speed` setting now accepts floating point values (by Starkku)
- `Strafing` is now disabled by default when using `Trajectory` (by CrimRecya)
- Modify Ammo on impact (by FS-21)

Vanilla fixes:
- Allow AI to repair structures built from base nodes/trigger action 125/SW delivery in single player missions (by Trsdy)
Expand Down
5 changes: 5 additions & 0 deletions src/Ext/WarheadType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
|| this->AttachEffects.RemoveGroups.size() > 0
|| this->BuildingSell
|| this->BuildingUndeploy
|| this->Ammo
);

char tempBuffer[32];
Expand Down Expand Up @@ -393,6 +394,8 @@ void WarheadTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
else
this->SpawnsCrate_Weights.push_back(weight);
}

this->Ammo.Read(exINI, pSection, "Ammo");
}

template <typename T>
Expand Down Expand Up @@ -575,6 +578,8 @@ void WarheadTypeExt::ExtData::Serialize(T& Stm)
.Process(this->DamageAreaTarget)

.Process(this->CanKill)

.Process(this->Ammo)
;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Ext/WarheadType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class WarheadTypeExt

Valueable<bool> CanKill;

Valueable<int> Ammo;

private:
Valueable<double> Shield_Respawn_Rate_InMinutes;
Valueable<double> Shield_SelfHealing_Rate_InMinutes;
Expand Down Expand Up @@ -396,6 +398,8 @@ class WarheadTypeExt
, KillWeapon_OnFirer_AffectsHouses { AffectedHouse::All }
, KillWeapon_Affects { AffectedTarget::All }
, KillWeapon_OnFirer_Affects { AffectedTarget::All }

, Ammo { 0 }
{ }

void ApplyConvert(HouseClass* pHouse, TechnoClass* pTarget);
Expand Down Expand Up @@ -432,6 +436,7 @@ class WarheadTypeExt
void ApplyAttachEffects(TechnoClass* pTarget, HouseClass* pInvokerHouse, TechnoClass* pInvoker);
void ApplyBuildingUndeploy(TechnoClass* pTarget);
double GetCritChance(TechnoClass* pFirer) const;
void ApplyAmmoModifier(TechnoClass* pTarget);
};

class ExtContainer final : public Container<WarheadTypeExt>
Expand Down
12 changes: 12 additions & 0 deletions src/Ext/WarheadType/Detonate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ void WarheadTypeExt::ExtData::DetonateOnOneUnit(HouseClass* pHouse, TechnoClass*
if (this->Crit_CurrentChance > 0.0 && (!this->Crit_SuppressWhenIntercepted || !bulletWasIntercepted))
this->ApplyCrit(pHouse, pTarget, pOwner);

if (this->Ammo != 0)
this->ApplyAmmoModifier(pTarget);

if (this->Convert_Pairs.size() > 0)
this->ApplyConvert(pHouse, pTarget);

Expand Down Expand Up @@ -641,3 +644,12 @@ double WarheadTypeExt::ExtData::GetCritChance(TechnoClass* pFirer) const

return critChance + extraChance;
}

void WarheadTypeExt::ExtData::ApplyAmmoModifier(TechnoClass* pTarget)
{
int maxAmmo = pTarget->GetTechnoType()->Ammo;
int newCurrentAmmo = this->Ammo + pTarget->Ammo;

newCurrentAmmo = newCurrentAmmo < 0 ? 0 : newCurrentAmmo;
pTarget->Ammo = newCurrentAmmo > maxAmmo ? maxAmmo : newCurrentAmmo;
}