Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -54,6 +54,43 @@ assert 'damage <= 0' in source and '!manager.ERR_IsRevivablePlayer()' in source
|
||||
assert 'override void Kill(' in source
|
||||
assert 'FullHeal(' not in source and 'SetHealth(' not in source
|
||||
print('PASS: authority-scoped slow recovery, bleeding pauses resilience, medicine unaffected, player-only lethal damage cap without healing')
|
||||
# The native bleeding evaluator recomputes severity after the hit has already
|
||||
# lowered health. Exercise production query/cap methods with native armour at
|
||||
# the virtual-call boundary: low remaining health must not erase wound severity.
|
||||
query=body(p, 'float ERR_ComputeWoundDamage(').replace('notnull BaseDamageContext', 'Context')
|
||||
effective=body(p, 'override float ComputeEffectiveDamage(')
|
||||
effective=effective.replace('override ', 'virtual ').replace('notnull BaseDamageContext', 'Context').replace('super.', 'Native::')
|
||||
effective=effective.replace('Replication.IsServer()', 'server').replace('SCR_CharacterResilienceHitZone.Cast(this)', 'resilience')
|
||||
effective=effective.replace('SCR_CharacterDamageManagerComponent manager = SCR_CharacterDamageManagerComponent.Cast(GetHitZoneContainer());', 'Manager* manager = target;').replace('manager.', 'manager->')
|
||||
effective=effective.replace('ERR_PlayerMedicalRules.', '').replace('EDamageState.DESTROYED', '0')
|
||||
run('''#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
bool server=true;
|
||||
struct Context {float value;};
|
||||
struct Manager {bool player=true;int knockouts=0;bool ERR_IsRevivablePlayer(){return player;}void ERR_RequestKnockout(){knockouts++;}};
|
||||
struct Native {virtual float ComputeEffectiveDamage(Context c,bool){return c.value;}};
|
||||
'''+cap+'''
|
||||
struct Policy:Native {
|
||||
bool m_ERRWoundQuery=false,resilience=false;Manager* target=nullptr;float health=1;
|
||||
float GetHealth(){return health;}float GetMaxHealth(){return 100;}float GetDamageStateThreshold(int){return 0;}
|
||||
'''+query+effective+'''
|
||||
};
|
||||
struct Armoured:Policy {float armour=1;float ComputeEffectiveDamage(Context c,bool dot) override {if(!dot)c.value*=armour;return Policy::ComputeEffectiveDamage(c,dot);}};
|
||||
int main(){Manager player;Armoured zone;zone.target=&player;
|
||||
assert(zone.ComputeEffectiveDamage({60},false)==0 && player.knockouts==1);
|
||||
assert(zone.ERR_ComputeWoundDamage({60})==60 && player.knockouts==1);
|
||||
assert(!zone.m_ERRWoundQuery && zone.ComputeEffectiveDamage({60},true)==0);
|
||||
assert(zone.ERR_ComputeWoundDamage({2})==2);
|
||||
zone.armour=.2f;assert(std::abs(zone.ERR_ComputeWoundDamage({60})-12)<.001f);
|
||||
assert(zone.ComputeEffectiveDamage({60},false)==0);
|
||||
zone.health=100;assert(std::abs(zone.ComputeEffectiveDamage({60},false)-12)<.001f);
|
||||
zone.health=1;player.player=false;assert(std::abs(zone.ComputeEffectiveDamage({60},false)-12)<.001f);
|
||||
player.player=true;zone.resilience=true;assert(std::abs(zone.ComputeEffectiveDamage({60},false)-12)<.001f);
|
||||
zone.resilience=false;server=false;assert(std::abs(zone.ComputeEffectiveDamage({60},false)-12)<.001f);
|
||||
}
|
||||
''')
|
||||
print('PASS: bleeding severity survives low health, retains armour, causes no knockout and restores the actual damage/blood-loss cap')
|
||||
# Run the production recovery prediction over real effect states modeled at the
|
||||
# native boundary, including a pending regeneration delay and exhausted effects.
|
||||
future=body(p,'bool ERR_CanRecoverNaturally(')
|
||||
|
||||
Reference in New Issue
Block a user