Example #1
0
 public virtual void CreateAction(FightObject[] targetTeam, int fightCount)
 {
     if (m_action == null || m_action.FightCount != fightCount)
     {
         FightAction action = new FightAction(ActionType.WuLi, ID, fightCount);
         action.Target = targetTeam[Sinan.Extensions.NumberRandom.Next(targetTeam.Length)].ID;
         this.m_action = action;
     }
 }
Example #2
0
        private void CreateAction(FightObject[] targetTeam, Variant v, int fightCount)
        {
            int actionType = v.GetIntOrDefault("ActionType");
            FightAction action = new FightAction((ActionType)actionType, this.ID, 0);
            action.Parameter = v.GetStringOrDefault("Parameter");
            action.SkillLev = v.GetIntOrDefault("Level", 1);

            //Target  1	自己
            //Target  2	队友n
            //Target  3	敌人n
            //Target  4	随机友方(n)
            //Target  5	随机敌人(n)
            //Target  6	血量最少的敌人(n)
            int actionTarget = v.GetIntOrDefault("ActionTarget");
            if (actionTarget <= 1)
            {
                action.Target = this.ID;
            }
            else if (actionTarget == 4 || actionTarget == 2)
            {
                int index = Sinan.Extensions.NumberRandom.Next(Team.Length);
                action.Target = Team[index].ID;
            }
            else if (actionTarget == 5 || actionTarget == 3)
            {
                int index = Sinan.Extensions.NumberRandom.Next(targetTeam.Length);
                action.Target = targetTeam[index].ID;
            }
            else if (actionTarget == 6)
            {
                int min = Int32.MaxValue;
                foreach (var target in targetTeam)
                {
                    if (target.HP > 0 && target.HP < min)
                    {
                        action.Target = target.ID;
                    }
                }
            }
            else
            {
                action.Target = string.Empty;
            }
            action.Say = NewTalk(v.GetVariantOrDefault("Talk"));
            action.FightCount = fightCount;
            this.m_action = action;
        }
Example #3
0
 public FightAction CopyNew()
 {
     FightAction action = new FightAction(this.ActionType, this.Sender, this.FightCount);
     action.Parameter = this.Parameter;
     action.SkillLev = this.SkillLev;
     action.Target = this.Target;
     return action;
 }