public void AddStringMonstersData(string data) { foreach (string monster in data.Split('|')) { if (monster != "") { try { string[] monsterData = monster.Split(','); int id = int.Parse(monsterData[0]); int level = int.Parse(monsterData[1]); Database.Records.MonstersTemplateRecord template = World.Helper.MonsterHelper.GetMonsterTemplate(id); if (template != null) { Database.Records.MonsterLevelRecord templateLevel = template.GetLevel(level); if (templateLevel != null) { this.PossibleMonsters.Add(templateLevel); } } } catch (Exception e) { Utilities.ConsoleStyle.Error("Can't add monster on map " + this._map.Map.ID + " : " + e.ToString()); } } } }
public void AddMonster(Database.Records.MonsterLevelRecord monster) { if (Leader == null) { this.Leader = monster; this.BonusTimer = new System.Timers.Timer(BONUS_TIME_RATE); this.BonusTimer.Enabled = true; this.BonusTimer.Elapsed += new System.Timers.ElapsedEventHandler(BonusTimer_Elapsed); this.BonusTimer.Start(); } Monsters.Add(monster); //Monsters.OrderBy(x => x.Level); }
public Fighter(int id, Database.Records.MonsterLevelRecord monster, Engines.Map.MonsterGroup group) { this.Drops = new FightDrops(this); this.MonsterGroup = group; this.Monster = monster; this._id = id; this._currentLife = this.Monster.Life; this.IsHuman = false; this.IsReady = true; this.IsDead = false; switch (Monster.GetTemplate.AI) { case 0: this.ArtificialBrain = new AI.StaticAI(this); break; case 1: case 2: this.ArtificialBrain = new AI.BasicAI(this); break; case 3: this.ArtificialBrain = new AI.FearfulAI(this); break; case 4: this.ArtificialBrain = new AI.ScriptedAI(this); if (this.Monster.GetTemplate.HasScriptAI()) { var scriptID = this.Monster.GetTemplate.Script; var script = new PyScript("Scripts/AI/" + scriptID); script.Load(this); (this.ArtificialBrain as AI.ScriptedAI).Script = script; } break; } this.CurrentAP = Stats.GetMaxActionPoints; this.CurrentMP = Stats.GetMaxMovementPoints; }
public static void SummonDouble(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID) { /* Create temp template for double summoned */ Database.Records.MonstersTemplateRecord tempTemplate = new Database.Records.MonstersTemplateRecord() { ID = -1, Color1 = caster.Character.Color1, Color2 = caster.Character.Color2, Color3 = caster.Character.Color3, Skin = caster.Character.Look, Name = caster.Nickname, Exp = 0, Kamas = "0,0", Drops = "", AI = 2, }; Database.Records.MonsterLevelRecord tempLevel = new Database.Records.MonsterLevelRecord() { ID = -1, TemplateID = -1, IsTempLevel = true, TempTemplate = tempTemplate, Level = caster.Level, AP = caster.Stats.GetMaxActionPoints, MP = caster.Stats.GetMaxMovementPoints, Life = caster.Stats.MaxLife, Size = caster.Character.Scal, Stats = "0,0,0,0,0", ProtectStats = "0,0,0,0", Spells = "", }; tempLevel.InitMonster(); Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, tempLevel, null); summonedCreature.CellID = cellID; summonedCreature.SummonOwner = caster.ID; summonedCreature.IsInvoc = true; fight.CurrentEntityTempID--; fight.AddPlayer(summonedCreature, caster.Team.ID, cellID); fight.TimeLine.RemixTimeLine(); fight.TimelineDisplay(); }
public void GenerateOneGroup() { try { MonsterGroup group = new MonsterGroup(); if (this._map.Map.FixedGroup == 0) { int groupSize = Utilities.Basic.Rand(1, this._maxMonsterPerGroup); for (int i = 0; i <= groupSize - 1; i++) { Database.Records.MonsterLevelRecord monster = GetRandomMonster(); if (monster != null) { group.AddMonster(monster); } } } else { foreach (var monster in this.PossibleMonsters) { group.AddMonster(monster); } } group.ID = this._map.GetActorAvailableID; if (this._map.Emitters.Count > 0) { group.CellID = this._map.Emitters[Utilities.Basic.Rand(0, this._map.Emitters.Count - 1)]; } else { group.CellID = this._map.RandomFreeCell().ID; } group.CreatePattern(); this.GroupsOnMap.Add(group); } catch (Exception e) { //TODO } }
public static void SummonCreature(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID) { if (fight.GetFighterOnCell(cellID) == null) { Database.Records.MonstersTemplateRecord template = World.Helper.MonsterHelper.GetMonsterTemplate(effect.Value); if (template != null) { Database.Records.MonsterLevelRecord level = template.Levels.FirstOrDefault(x => x.Level == spellLevel.Level); if (level != null) { Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, level, null); summonedCreature.CellID = cellID; summonedCreature.SummonOwner = caster.ID; summonedCreature.IsInvoc = true; fight.CurrentEntityTempID--; fight.AddPlayer(summonedCreature, caster.Team.ID, cellID); fight.TimeLine.RemixTimeLine(); fight.TimelineDisplay(); } } } }
public StatsEngine(Database.Records.MonsterLevelRecord monster) { this.Life.Base = monster.Life; this.ActionPoints.Base = monster.AP; this.MovementPoints.Base = monster.MP; }