-
-
Save Berdagon/6ae42e4ff6b0964808a91d32951c52e4 to your computer and use it in GitHub Desktop.
A simple code to allow Debugging of damage types for Cyberpunk Redscript modding
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
@replaceMethod(DamageSystem) | |
private final func ApplyStatusEffectByApplicationRate(hitEvent: ref<gameHitEvent>, statType: gamedataStatType, effect: TweakDBID) -> Void { | |
let rand: Float; | |
let ss: ref<StatsSystem> = GameInstance.GetStatsSystem(hitEvent.target.GetGame()); | |
let ses: ref<StatusEffectSystem> = GameInstance.GetStatusEffectSystem(hitEvent.target.GetGame()); | |
let weapon: wref<WeaponObject> = hitEvent.attackData.GetWeapon(); | |
let value: Float = ss.GetStatValue(Cast<StatsObjectID>(weapon.GetEntityID()), statType) / 100.00; | |
if hitEvent.target.IsPlayer() { | |
return; | |
}; | |
if !FloatIsEqual(value, 0.00) { | |
rand = RandRangeF(0.00, 1.00); | |
if rand <= value { | |
if !this.IsImmune(hitEvent.target, effect, hitEvent.attackData) { | |
ses.ApplyStatusEffect(hitEvent.target.GetEntityID(), effect,GameObject.GetTDBID(hitEvent.attackData.GetInstigator()), hitEvent.attackData.GetInstigator().GetEntityID()); | |
LogChannel(n"DEBUG",s"StatusEffect Applied: \(TDBID.ToStringDEBUG(effect))"); | |
hitEvent.attackData.AddFlag(Equals(statType, gamedataStatType.StunApplicationRate) ? hitFlag.StunApplied : hitFlag.DotApplied, n"SETriggered"); | |
}; | |
}; | |
}; | |
} | |
@wrapMethod(DamageSystem) | |
private final func ProcessPipeline(hitEvent: ref<gameHitEvent>, cache: ref<CacheData>) -> Void { | |
let elecDmg: Float = hitEvent.attackComputed.GetAttackValue(gamedataDamageType.Electric); | |
let thermDmg: Float = hitEvent.attackComputed.GetAttackValue(gamedataDamageType.Thermal); | |
let chemDmg: Float = hitEvent.attackComputed.GetAttackValue(gamedataDamageType.Chemical); | |
let physDmg: Float = hitEvent.attackComputed.GetAttackValue(gamedataDamageType.Physical); | |
LogChannel(n"DEBUG",s"ProcessPipeline elecdmg: \(elecDmg), chemdmg: \(chemDmg), thermdmg: \(thermDmg), physdmg: \(physDmg)"); | |
wrappedMethod(hitEvent,cache); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment