public static Actor Create(ActorType type, int r, int c) { return Create(type, r, c, false, false); } //not sure that false,false should be the default here
 public static Actor Create(ActorType type, int r, int c, bool add_to_tiebreaker_list, bool insert_after_current)
 {
     Actor a = null;
     if (M.actor[r, c] == null)
     {
         a = new Actor(proto[type], r, c);
         M.actor[r, c] = a;
         if (add_to_tiebreaker_list)
         {
             if (insert_after_current)
             {
                 tiebreakers.Insert(Q.Tiebreaker + 1, a);
                 Q.UpdateTiebreaker(Q.Tiebreaker + 1);
                 Event e = new Event(a, a.speed, EventType.MOVE);
                 e.tiebreaker = Q.Tiebreaker + 1;
                 Q.Add(e);
             }
             else
             {
                 tiebreakers.Add(a);
                 Event e = new Event(a, a.speed, EventType.MOVE);
                 e.tiebreaker = tiebreakers.Count - 1; //since it's the last one
                 Q.Add(e);
             }
         }
         else
         {
             a.QS();
         }
         if (a.light_radius > 0)
         {
             a.UpdateRadius(0, a.light_radius);
         }
     }
     return a;
 }
Example #2
0
 public static Actor Create(ActorType type,int r,int c,TiebreakerAssignment tiebreaker)
 {
     Actor a = null;
     if(M.actor[r,c] == null){
         a = new Actor(proto[type],r,c);
         M.actor[r,c] = a;
         switch(tiebreaker){
         case TiebreakerAssignment.AtEnd:
         {
             tiebreakers.Add(a);
             Event e = new Event(a,a.Speed(),EventType.MOVE);
             e.tiebreaker = tiebreakers.Count - 1; //since it's the last one
             Q.Add(e);
             break;
         }
         case TiebreakerAssignment.InsertAfterCurrent:
         {
             tiebreakers.Insert(Q.Tiebreaker + 1,a);
             Q.UpdateTiebreaker(Q.Tiebreaker + 1);
             Event e = new Event(a,a.Speed(),EventType.MOVE);
             e.tiebreaker = Q.Tiebreaker + 1;
             Q.Add(e);
             break;
         }
         case TiebreakerAssignment.UseCurrent:
         {
             tiebreakers[Q.Tiebreaker] = a;
             a.QS();
             break;
         }
         }
         if(R.OneIn(10) && a.Is(ActorType.SWORDSMAN,ActorType.BERSERKER,ActorType.ENTRANCER,ActorType.DERANGED_ASCETIC,ActorType.ALASI_BATTLEMAGE,ActorType.ALASI_SCOUT,
             ActorType.ALASI_SENTINEL,ActorType.ALASI_SOLDIER,ActorType.PYREN_ARCHER,ActorType.NECROMANCER)){
             a.light_radius = 4;
         }
         if(a.light_radius > 0){
             a.UpdateRadius(0,a.light_radius);
         }
     }
     return a;
 }