mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Weapon evolution
This commit is contained in:
parent
8492c3644b
commit
f58b9646df
10 changed files with 209 additions and 68 deletions
|
|
@ -48,6 +48,15 @@ public partial class DamageReceiverActorModule : ActorModule, IHittable
|
|||
if (BulletGroup is BulletOwner.None)
|
||||
{
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
|
||||
// If this hit killed the actor, attribute XP to the source weapon if present
|
||||
if (HealthProvider.CurrentResource <= 0 && bullet.BulletInfo?.SourceWeapon != null)
|
||||
{
|
||||
// Award XP equal to actor's MotivationReward rounded to int, or a fixed value.
|
||||
var xp = (int)System.Math.Round(_actor.EnemyData?.MotivationReward ?? 0f);
|
||||
bullet.BulletInfo.SourceWeapon.GainExperience(xp);
|
||||
}
|
||||
|
||||
bullet.RequestCollisionDestruction();
|
||||
return;
|
||||
}
|
||||
|
|
@ -55,6 +64,14 @@ public partial class DamageReceiverActorModule : ActorModule, IHittable
|
|||
if (bullet.BulletInfo.Owner == BulletGroup) return;
|
||||
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
|
||||
// Attribute XP on lethal hit
|
||||
if (HealthProvider.CurrentResource <= 0 && bullet.BulletInfo?.SourceWeapon != null)
|
||||
{
|
||||
var xp = (int)System.Math.Round(_actor.EnemyData?.MotivationReward ?? 0f);
|
||||
bullet.BulletInfo.SourceWeapon.GainExperience(xp);
|
||||
}
|
||||
|
||||
bullet.RequestCollisionDestruction();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue