Forcing specific weapon by target type#1631
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
|
besides, if you're certain that weapons of a techno won't make use of the following things, you can use this ability to make it skip previous weapon index picking logic, to save some calculation cost
a similar optimization was also made in #1568 |
There was a problem hiding this comment.
I think after updating it, we can merge this.
By the way, my opinion on ForceWeapon.Naval is probably like this, what do you think?
case AbstractType::Unit:
{
forceWeaponIndex = (this->ForceAAWeapon_Units >= 0 && pTarget->IsInAir())
? this->ForceAAWeapon_Units
: ((this->ForceWeapon_Naval >= 0 && pTargetType->Naval)
? this->ForceWeapon_Naval
: this->ForceWeapon_Units);
break;
}
|
610296a to
4027758
Compare
In this case, I think it's necessary to further distinguish between vehicles and buildings that |
…type # Conflicts: # CREDITS.md # docs/New-or-Enhanced-Logics.md # src/Ext/Techno/Body.h # src/Ext/Techno/Hooks.Firing.cpp # src/Ext/Techno/WeaponHelpers.cpp # src/Ext/TechnoType/Body.cpp
4027758 to
5b4225b
Compare
…type # Conflicts: # CREDITS.md
3960bfd to
7a543a0
Compare
Since when is allowed in the code style of this project the concatenated inlined if? (I dont know if inlined is the right word in English for the "condition ? value1 : value2" ) |
Phobos-developers#1631 ForceWeapon.Affects[Type]=bool 大类过滤
This is a supplement for #1695. With multiple weapons being set, you can use
ForceWeaponto enable them when attacking different targets. This pull request is a basic one that should be enough for many casesForceWeapon.Naval.Unitsforces specified weapon to be used againstNaval=yesunits. Taking priority toForceWeapon.Units.ForceWeapon.Defensesis enabled, it'll be used if the target is a building withBuildCat=Combat. Otherwise it'll followForceWeapon.Buildings, if enabled.ForceWeapon.Infantry/Units/Aircraftcan be applied to both ground and air target ifForceAAWeapon.Infantry/Units/Aircraftis not set.ForceAAWeapon.Infantry/Units/Aircraftdo the same things but only for air target. Taking priority toForceWeapon.Infantry/Units/Naval.Units/Aircraft, which means that they can only be applied to ground target when they're both set.In
rulesmd.ini: