public StatsComponent(ulong id, Dictionary<StatType, uint> stats, DeathEvent dEvent) : base(id) { OnDeath = dEvent; foreach (StatType t in stats.Keys) { BaseStats.Add(t, (double)stats[t]); CurrentStats.Add(t, (double)stats[t]); } }
/// <summary> /// Execute an operation and manage check resulting event with CombatStatusEffect Rules if any /// </summary> /// <param name="operation">Operation.</param> private void ExecuteAttackOperation(ICombatOperation operation, CombatResolver srcResolver, CombatResolver destResolver, StatusEffectRule [] effectRules) { // check to see if we were alive before executing the event BattleEntity destEntity = destResolver.entity; bool wasAlive = destEntity.currentHP > 0; // execute and apply damage IBattleEvent battleEvent = null; BattleEventType eventType = battleEvent.EventType; // notify resulting battle event BattleSystem.Instance.PostBattleEvent(battleEvent); // check to see if it was a damage event to see if we killed them if (eventType == BattleEventType.DAMAGE && wasAlive && destEntity.currentHP <= 0) { destEntity.character.curHP = 0; DeathEvent deathEvent = new DeathEvent(destEntity); BattleSystem.Instance.PostBattleEvent(deathEvent); } // lets see if we hit the target or not bool hitTarget = eventType == BattleEventType.DAMAGE || eventType == BattleEventType.NON_DAMAGE || eventType == BattleEventType.ITEM; bool missedTarget = eventType == BattleEventType.DODGE || eventType == BattleEventType.RESIST; // iterate through combnat effects to see what should apply foreach (StatusEffectRule combatStatusEffect in effectRules) { switch(combatStatusEffect.rule) { case StatusEffectRule.StatusEffectRuleHitPredicate.ON_HIT: if(hitTarget) { ApplyEffect(combatStatusEffect, srcResolver.entity); } break; case StatusEffectRule.StatusEffectRuleHitPredicate.ON_MISS: if(missedTarget) { ApplyEffect(combatStatusEffect, srcResolver.entity); } break; case StatusEffectRule.StatusEffectRuleHitPredicate.ALWAYS: default: ApplyEffect(combatStatusEffect, srcResolver.entity); break; } } }
// --- Constructors --- public Actor(GameExt pmGame, Model pmModel, Vector3 pmPos) { game= pmGame; bAlive= true; model= pmModel; world= Matrix.Identity; color= Color.White; texture= null; eonRespawn= null; eonDeath= null; pos= pmPos; }
public override void OnEvent(DeathEvent evnt) { //update scores if (ServerConnectionEventListener.IndexMap.ContainsPlayer(evnt.Killer)) { GameStats.SetIntegerStat(evnt.Killer, "Kills", GameStats.GetIntegerStat(evnt.Killer, "Kills") + 1); } if (ServerConnectionEventListener.IndexMap.ContainsPlayer(evnt.Player)) { GameStats.SetIntegerStat(evnt.Player, "Deaths", GameStats.GetIntegerStat(evnt.Player, "Deaths") + 1); } //because of the Owner/ProxyPlayer abstraction, this line will either just move the server's player, or //send an MovePlayerEvent to the propper player! GameManager.instance.gameMode.MovePlayerToSpawnPoint(PlayerRegistry.GetIPlayerForUserName(evnt.Player)); GameManager.instance.CheckForGameOver(); }
public override void OnDeath(DeathEvent e) { dead = true; }
public void OnPlayerKilled(DeathEvent evt) { Invoke("On_PlayerKilled", evt); }
public void OnDeath(DeathEvent evnt) { count(evnt); }
void Die() { DeathEvent deathEvent = new DeathEvent(this.gameObject, deathSound, deathParticle); deathEvent.FireEvent(); }
protected Creature(IMap map, IGrowable growable, DeathEvent deathEvent, IEventRecorder eventRecorder) : base(map, deathEvent, eventRecorder) { CurrentAge = 0; _growable = growable; _growable.GrowableOwner = this; }
// Called when the node enters the scene tree for the first time. public override void _Ready() { DeathEvent.RegisterListener(PlayerDeath); }
public override void _ExitTree() { WinEvent.UnregisterListener(ShowWinScreen); DeathEvent.UnregisterListener(ShowDeathScreen); }
public void OnPlayerKilled(DeathEvent de) { if (de.DamageType != null && de.Attacker != null && de.Victim != null && (de.AttackerIsPlayer || de.AttackerIsNPC || de.AttackerIsEntity)) { Fougerite.Player victim = (Fougerite.Player)de.Victim; string victimname = victim.Name; if (de.AttackerIsNPC) { string killername = ((NPC)de.Attacker).Name; if (ean == 1) { string a = animal; a = a.Replace("victim", victimname); a = a.Replace("killer", killername); Server.GetServer().BroadcastFrom(DeathMSGName, a); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + a); } } } else if (de.AttackerIsPlayer) { Fougerite.Player attacker = (Fougerite.Player)de.Attacker; ulong vid = victim.UID; ulong aid = attacker.UID; if (vid == aid && esn == 1) { string n = suicide; n = n.Replace("victim", victimname); Server.GetServer().BroadcastFrom(DeathMSGName, n); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + n); } return; } string weapon = de.WeaponName; string bodyPart = BodiesData[de.DamageEvent.bodyPart.ToString()]; Vector3 killerloc = attacker.Location; Vector3 location = victim.Location; double distance = Math.Round(Vector3.Distance(killerloc, location)); double damage = Math.Round(de.DamageAmount); string bleed = de.DamageType; if (bleed == "Bullet") { string message; if (de.VictimIsSleeper) { if (essn == 0) { return; } message = sleeper; } else { message = Bullet; } string n = message.Replace("victim", victimname); n = n.Replace("killer", attacker.Name); n = n.Replace("weapon", weapon); n = n.Replace("damage", damage.ToString()); n = n.Replace("number", distance.ToString()); n = n.Replace("bodyPart", bodyPart); int c = 0; string calc = "Not Available"; if (bodyPart == "Head") { if (DataStore.GetInstance().Get("DeathMSGAVG", attacker.UID) == null) { DataStore.GetInstance().Add("DeathMSGAVG", attacker.UID, 1); c = 1; } else { c = (int)DataStore.GetInstance().Get("DeathMSGAVG", attacker.UID) + 1; DataStore.GetInstance().Add("DeathMSGAVG", attacker.UID, c); } } else { if (DataStore.GetInstance().Get("DeathMSGAVG2", attacker.UID) == null) { DataStore.GetInstance().Add("DeathMSGAVG2", attacker.UID, 1); c = 1; } else { c = (int)DataStore.GetInstance().Get("DeathMSGAVG2", attacker.UID) + 1; DataStore.GetInstance().Add("DeathMSGAVG2", attacker.UID, c); } } if (c >= 5) { object cd = DataStore.GetInstance().Get("DeathMSGAVG2", attacker.UID); if (cd != null) { int cd2 = (int)cd; double cc = c / cd2; calc = Math.Round(cc).ToString(); n = n + " (HAvg: " + calc + "% )"; } } Server.GetServer().BroadcastFrom(DeathMSGName, n); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + n); } if (autoban == 1) { int range = RangeOf(weapon); if (range == -1 || weapon.ToLower().Contains("spike")) { return; } if (distance > range) { var tpfriendteleport = DataStore.GetInstance().Get("tpfriendautoban", aid); var hometeleport = DataStore.GetInstance().Get("homesystemautoban", aid); if (hometeleport == null || string.IsNullOrEmpty((string)hometeleport) || (string)hometeleport == "none" || tpfriendteleport == null || string.IsNullOrEmpty((string)tpfriendteleport) || (string)tpfriendteleport == "none") { string z = banmsg; z = z.Replace("killer", attacker.Name); if (distance >= 1000) { return; } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 0, killerloc.ToString(), location.ToString(), calc); } DataStore.GetInstance().Add("DeathMSGBAN", vid, location); Server.GetServer().BroadcastFrom(DeathMSGName, red + z); Server.GetServer() .BanPlayer(attacker, "Console", "Range Ban: " + distance + " Gun: " + weapon); } else { string t = tpamsg; t = t.Replace("killer", attacker.Name); if (distance >= 1000) { return; } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 1, killerloc.ToString(), location.ToString(), calc); } Server.GetServer().BroadcastFrom(DeathMSGName, t); DataStore.GetInstance().Remove("tpfriendautoban", aid); DataStore.GetInstance().Remove("homesystemautoban", aid); } return; } } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 0, killerloc.ToString(), location.ToString(), calc); } } else if (bleed == "Melee") { string hn = huntingbow; if (weapon == "Hunting Bow") { if (de.VictimIsSleeper && essn == 1) { hn = sleeper; } else { return; } hn = hn.Replace("victim", victimname); hn = hn.Replace("killer", attacker.Name); hn = hn.Replace("damage", damage.ToString()); hn = hn.Replace("number", distance.ToString()); hn = hn.Replace("bodyPart", bodyPart); Server.GetServer().BroadcastFrom(DeathMSGName, hn); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + hn); } if (autoban == 1) { int range = RangeOf(weapon); if (range == -1 || weapon.ToLower().Contains("spike")) { return; } if (distance > range) { var tpfriendteleport = DataStore.GetInstance().Get("tpfriendautoban", aid); var hometeleport = DataStore.GetInstance().Get("homesystemautoban", aid); if (hometeleport == null || string.IsNullOrEmpty((string)hometeleport) || (string)hometeleport == "none" || tpfriendteleport == null || string.IsNullOrEmpty((string)tpfriendteleport) || (string)tpfriendteleport == "none") { string z = banmsg; z = z.Replace("killer", attacker.Name); if (distance >= 1000) { return; } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 0, killerloc.ToString(), location.ToString()); } DataStore.GetInstance().Add("DeathMSGBAN", vid, location); Server.GetServer().BroadcastFrom(DeathMSGName, red + z); Server.GetServer() .BanPlayer(attacker, "Console", "Range Ban: " + distance + " Gun: " + weapon); } else { string t = tpamsg; t = t.Replace("killer", attacker.Name); if (distance >= 1000) { return; } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 1, killerloc.ToString(), location.ToString()); } Server.GetServer().BroadcastFrom(DeathMSGName, t); DataStore.GetInstance().Remove("tpfriendautoban", aid); DataStore.GetInstance().Remove("homesystemautoban", aid); } return; } } if (KillLog == 1) { Log(attacker.Name, weapon, distance.ToString(), victimname, bodyPart, damage.ToString(), 0, killerloc.ToString(), location.ToString()); } } else if (weapon == "Spike Wall" && de.AttackerIsEntity) { string ownername = de.Entity.OwnerName; string s = spike; s = s.Replace("victim", victimname); s = s.Replace("killer", ownername); s = s.Replace("weapon", "Spike Wall"); Server.GetServer().BroadcastFrom(DeathMSGName, s); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + s); } } else if (weapon == "Large Spike Wall" && de.AttackerIsEntity) { string ownername = de.Entity.OwnerName; string s = spike; s = s.Replace("victim", victimname); s = s.Replace("killer", ownername); s = s.Replace("weapon", "Spike Wall"); Server.GetServer().BroadcastFrom(DeathMSGName, s); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + s); } } else { string n = Bullet; n = n.Replace("victim", victimname); n = n.Replace("killer", attacker.Name); n = n.Replace("weapon", weapon); n = n.Replace("damage", damage.ToString()); n = n.Replace("number", distance.ToString()); n = n.Replace("bodyPart", bodyPart); Server.GetServer().BroadcastFrom(DeathMSGName, n); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + n); } } } else if (bleed == "Explosion") { string x = explosion; x = x.Replace("killer", attacker.Name); x = x.Replace("victim", victimname); if (weapon == "F1 Grenade") { x = x.Replace("weapon", "F1 Grenade"); } else if (weapon == "Explosive Charge") { x = x.Replace("weapon", "C4"); } Server.GetServer().BroadcastFrom(DeathMSGName, x); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + x); } } else if (bleed == "Bleeding") { string n = bleeding; n = n.Replace("victim", victimname); n = n.Replace("killer", attacker.Name); Server.GetServer().BroadcastFrom(DeathMSGName, n); if (EnableConsoleKills == 1) { Logger.Log("[Death] " + n); } } } } }
protected void Die() { DeathEvent?.Invoke(this); FX_Spawner.instance.SpawnFX(FXType.Death, transform.position, Vector2.up); Destroy(gameObject); }
public override void OnEvent(DeathEvent evnt) { base.OnEvent(evnt); Instantiate(spawnOnDeath, transform.position, Quaternion.identity); }
void PlayerKilled(DeathEvent deathEvent) { }
public void OnPlayerKilled(DeathEvent evt) { this.Invoke("On_PlayerKilled", new object[] { evt }); }
public void Death(GameObject damager, int damage, Vector2 point, Vector2 direction) { DeathEvent?.Invoke(damager, damage, point, direction); gameObject.SetActive(false); }
public Tree(IMap map, IGrowable growable, IEatable eatable, DeathEvent deathEvent, IEventRecorder eventRecorder) : base(map, growable, eatable, deathEvent, eventRecorder) { Hp = 500; }
public virtual void OnDeath(DeathEvent evnt) { }
public void HandleEvent(DeathEvent e) { boardPresenter.GetUnit(e.Coord).Hide(); boardPresenter.RemoveUnit(e.Coord); }
public void OnNPCKilled(DeathEvent de) { this.Invoke("On_NPCKilled", new object[] { de }); }
public void OnPlayerKilled(DeathEvent de) { this.Invoke("On_PlayerKilled", new object[] { de }); }
void OnDeathEvent(DeathEvent e) { wonGame = e.wonGame; }
public Sparrow(IMap map, IGrowable growable, IMovable movable, IEater eater, IGender gender, DeathEvent deathEvent, IEventRecorder eventRecorder) : base(map, growable, movable, eater, gender, deathEvent, eventRecorder) { Hp = 10; }
protected void InvokeDeath() { DeathEvent?.Invoke(this, EventArgs.Empty); }
public void OnNPCKilled(DeathEvent evt) { Invoke("On_NPCKilled", evt); }
public Rock(IMap map, DeathEvent deathEvent, IEventRecorder eventRecorder) : base(map, deathEvent, eventRecorder) { Hp = 500; }
private void CreateDeathEvent() { DeathEvent?.Invoke(this, new EventArgs()); }
public virtual void OnDeath(DeathEvent evnt) { _myRobot.OnDeath(evnt); }
public override void OnDeath(DeathEvent e) { Out.WriteLine("Death!"); }
/// <summary> /// Убить персонажа /// </summary> public void KillPlayer(DeathType deathType) { _thisPlayerDied = true; DeathEvent?.Invoke(deathType); }
public void OnNPCKilled(DeathEvent evt) { this.Invoke("On_NPCKilled", new object[] { evt }); }
private void TriggerDeathEvent() { DeathEvent?.Invoke(); }
public void ExecuteDeath(IAttacker dealer, int value, DamageType type) { DeathEvent.Call(new DeathEventArgs(this, dealer, value, type)); }
protected virtual void OnDeath(DeathEvent e) {}