예제 #1
0
파일: Creature.cs 프로젝트: OCox1991/Genome
 /// <summary>
 /// Controls ambush behaviour, where a creature tries to sneak up next to another to get a high damage special attack
 /// </summary>
 /// <param name="c"></param>
 public void ambush(Creature c)
 {
     if (isStealthy())
     {
         if (!c.canSee(this))
         {
             if (isAdjacent(c))
             {
                 c.damage((getStrength() / 2) + getStealthVal());
                 spotted();
             }
             else
             {
                 moveTowards(c);
             }
         }
         else
         {
             spotted();
         }
     }
     else
     {
         hide();
     }
 }