public void RemoveOldCorpses(DateTime utcDate) { if (Corpses.Count > 0) { while (Corpses.Count > 0 && Corpses[0].TimeOfDeath < utcDate) { Corpses.RemoveAt(0); } } }
/// <summary> /// Occurs when you die /// </summary> /// <param name="d"></param> public override void OnDie(MapObject d) { if (d != null && MapObject.IsPlayer(d)) { Die((Character)d); } //Clear all hate hatetable = new HateCollection(); //Stop attacking Saga.Tasks.BattleThread.Unsubscribe(this); //Subscribe as corpse Corpses.Subscribe(this); }
public override ICorpse Die() { ICorpse corpse = base.Die(); Corpses.Add(corpse.Clone()); //because if someone picks something up out of the corpse it will be reflected here Room.RemoveMobileObjectFromRoom(this); Room.Items.Insert(0, corpse); Room = GlobalReference.GlobalValues.World.Zones[RespawnPoint.Zone].Rooms[RespawnPoint.Id]; Room.AddMobileObjectToRoom(this); Health = 1; Mana = 1; Stamina = 1; EnqueueCommand("Look"); GlobalReference.GlobalValues.Engine.Event.EnterRoom(this); return(corpse); }
public override ICorpse Die(IMobileObject attacker) { AddTitle("{performer} the resurrected."); ICorpse corpse = base.Die(attacker); corpse.LookDescription = $"The corpse of {SentenceDescription} lies here."; Corpses.Add(corpse.Clone()); //because if someone picks something up out of the corpse it will be reflected here Room.RemoveMobileObjectFromRoom(this); Room.AddItemToRoom(corpse, 0); Room = GlobalReference.GlobalValues.World.Zones[RespawnPoint.Zone].Rooms[RespawnPoint.Id]; Room.AddMobileObjectToRoom(this); Health = 1; Mana = 1; Stamina = 1; EnqueueCommand("Look"); GlobalReference.GlobalValues.Engine.Event.EnterRoom(this); IsAlive = true; //the player is alive again return(corpse); }
void InitialConditions() { Color[] _unit = new Color[w * h]; Color[] _data = new Color[w * h]; Color[] _extra = new Color[w * h]; Color[] _target = new Color[w * h]; Color[] _random = new Color[w * h]; Color[] _tiles = new Color[w * h]; Color[] _corpses = new Color[w * h]; CurrentData.GetData(_data); var rnd = new System.Random(); for (int i = 0; i < w; i++) { for (int j = 0; j < h; j++) { _random[i * h + j] = new Color(rnd.IntRange(0, 256), rnd.IntRange(0, 256), rnd.IntRange(0, 256), rnd.IntRange(0, 256)); _corpses[i * h + j] = new Color(0, 0, 0, 0); _tiles[i * h + j] = new Color(2, rnd.Next(0, 11), 30, 0); // Random units //if (rnd.NextDouble() > 0.85f) //{ // int dir = rnd.Next(1, 5); // int action = (int)(255f * SimShader.UnitAction.Attacking); // int g = 0; // int b = 0; // int player = rnd.Next(1, 2); // int team = player; // int type = rnd.Next(1, 2); // _unit[i * h + j] = new Color(type, player, team, 0); // _data[i * h + j] = new Color(dir, g, b, action); // _extra[i * h + j] = new Color(0, 0, 0, 0); // _target[i * h + j] = new Color(rnd.Next(0, 4), rnd.Next(0, 256), rnd.Next(0, 4), rnd.Next(0, 256)); //} //else //{ // _unit[i * h + j] = new Color(0, 0, 0, 0); // _data[i * h + j] = new Color(0, 0, 0, 0); // _extra[i * h + j] = new Color(0, 0, 0, 0); // _target[i * h + j] = new Color(0, 0, 0, 0); //} } } // Gold mine gride //for (int i = 0; i < w; i += 50) //for (int j = 0; j < h; j += 50) //{ // Create.MakeBuilding(vec(i,j), SimShader.UnitType.GoldMine, Player.None, Team.None, i, j, w, h, _unit, _data, _target); //} CurrentUnits.SetData(_unit); PreviousUnits.SetData(_unit); CurrentData.SetData(_data); PreviousData.SetData(_data); Extra.SetData(_extra); TargetData.SetData(_target); RandomField.SetData(_random); Tiles.SetData(_tiles); Corpses.SetData(_corpses); }