using System; using System.Drawing; using System.Collections; using System.IO; [assembly: AuthorInformationAttribute("TeamDA", "TeamDA@d-advantage.jp")] [assembly: OrganismClass("Komagome")] [CarnivoreAttribute(true)] [MatureSize(25)] [AnimalSkin(AnimalSkinFamilyEnum.Scorpion)] [MaximumEnergyPoints(14)] // 体力 [EatingSpeedPoints(2)] // 動物を食べる速さ [AttackDamagePoints(16)] // 攻撃力 [DefendDamagePoints(8)] // 防御力 [MaximumSpeedPoints(18)] // 移動の速度 [CamouflagePoints(20)] // 偽装(身を隠す)能力 [EyesightPoints(20)] // 視野の広さ public class Komagome : KAnimal { // /////////////////////////////////////////////////////////////////////////// protected bool IsRetire { get { return Species.LifeSpan - State.TickAge < Species.ReproductionWait ; } } // /////////////////////////////////////////////////////////////////////////// private void Attack(AnimalState target) { if(target == null) return; if(WithinAttackingRange(target) && CanAttack(target)) { BeginAttacking(target); BeginDefending(target); } else { BeginChase(target); } } private void Eat(OrganismState target) { if(target == null) return; if(CanEat(target)) { StopMoving(); BeginEating(target); } else { BeginMoving(target); } } // /////////////////////////////////////////////////////////////////////////// protected void ReproducingAction(object sender, IdleEventArgs e) { StopMoving(); if(Threat != null) { RunAway(Threat); } else if(State.EnergyState == EnergyState.Hungry || State.EnergyState == EnergyState.Deterioration) { NotReproducingAction(sender, e); } } protected void NotReproducingAction(object sender, IdleEventArgs e) { if(Threat != null) { RunAway(Threat); } else if(Food != null) { Eat(Food); } else if(Brunt != null) { Attack(Brunt); } else { Wander(4); } } // /////////////////////////////////////////////////////////////////////////// protected override void IdleEvent(object sender, IdleEventArgs e) { try { BeginEating(Food); BeginAttacking(Brunt); BeginDefending(Threat); if(IsReproducing) { ReproducingAction(sender, e); } else { NotReproducingAction(sender, e); } } catch(Exception exc) { WriteTrace(exc); } } protected override bool IsFood(OrganismState target) { if(IsRetire) return false; AnimalState a = target as AnimalState; if(a == null) return false; return !a.IsAlive; } protected override bool IsThreat(OrganismState target) { AnimalState a = target as AnimalState; if(a == null) return false; return a.IsAlive && !IsMySpecies(a) && !CanWin(a); } protected override bool IsBrunt(OrganismState target) { AnimalState a = target as AnimalState; if(a == null) return false; return a.IsAlive && !IsMySpecies(a) && CanWin(a); } // /////////////////////////////////////////////////////////////////////////// }