/// <inheritdoc /> public BaseCreature CreateCreature(string name, int atk, int def, int hp, CustomRange dmgRange) { try { BaseCreature baseCreature = new GenericCreature(name, atk, def, hp, dmgRange); BaseCreature creature = new MeleeCreature(baseCreature); return(creature); } catch (Exception e) { Console.WriteLine(e); Logger.Log(TraceEventType.Critical, $"Creature creation error. Error message: {e.Message}"); Logger.Log(TraceEventType.Verbose, $"StackTrace: {e.StackTrace}"); throw; } }
/// <inheritdoc /> public BaseCreature CreateCreature <T>(string name, int atk, int def, int hp, CustomRange dmgRange) where T : BaseCreature, new() { try { BaseCreature creature = new T(); creature.Name = name; creature.Attack = atk; creature.Defense = def; creature.Hitpoints = hp; creature.Damage = dmgRange; return(creature); } catch (Exception e) { Console.WriteLine(e); Logger.Log(TraceEventType.Critical, $"Creature creation error. Error message: {e.Message}"); Logger.Log(TraceEventType.Verbose, $"StackTrace: {e.StackTrace}"); throw; } }
public GenericCreature(string name, int attack, int defense, int hitpoints, CustomRange damage, Point position, bool isCaster) : base(name, attack, defense, hitpoints, damage, position, isCaster) { }
public GenericCreature(string name, int attack, int defense, int hitpoints, CustomRange damage) : base(name, attack, defense, hitpoints, damage) { }