Ejemplo n.º 1
0
    public override bool onInit(unitControler unit, Buff[] Repetitive, Dictionary <string, object> args)
    {
        if (Repetitive.Length == 0)
        {
            timeLeft  = (float)args["time"];
            shieldNum = (int)args["num"];
            creater   = (BasicControler)args["creater"];
            this.unit = (BasicControler)unit;


            GameObject prefab = effection_prefab;
            if (prefab != null)
            {
                effection = Instantiate(prefab, ((BasicControler)this.unit).transform);
                effection.transform.localPosition = prefab.transform.position;
            }
            ((BasicControler)unit)._befTakeDamage += beforeTakeDamage;
            return(true);
        }
        else
        {
            if (((buff_shieldTemplate)Repetitive[0]).TimeLeft < (float)args["time"])
            {
                ((buff_shieldTemplate)Repetitive[0]).timeLeft = (float)args["time"];
            }
            if (((buff_shieldTemplate)Repetitive[0]).shieldNum < (int)args["num"])
            {
                ((buff_shieldTemplate)Repetitive[0]).shieldNum = (int)args["num"];
            }
            return(false);
        }
    }
Ejemplo n.º 2
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     information         = new SkillInf(false, false, false, new List <string>());
     this.owner          = (BasicControler)owner;
     deleg._BefUseSkill += callback;
     //int point = Randomer.main.getInt();
 }
Ejemplo n.º 3
0
    public override bool onInit(unitControler unit, Buff[] Repetitive, Dictionary <string, object> args)
    {
        int   num  = (int)args["num"];
        float time = (float)args["time"];

        if (Repetitive.Length > 0)
        {
            buff_ArmorBreak buff = (buff_ArmorBreak)Repetitive[0];
            if (buff.number < num)
            {
                buff.number = num;
            }
            if (buff.TimeLeft < time)
            {
                buff.timeLeft = time;
            }
            return(false);
        }
        else
        {
            timeLeft = time;
            ((BasicControler)unit).data.Now_Armor -= num;
            number = num;
            GameObject prafeb = objectList.main.prafebList[8];
            effection = Instantiate(prafeb, gameObject.transform);
            effection.transform.localPosition = prafeb.transform.position;
            effection.transform.localScale    = prafeb.transform.localScale;
            this.unit = unit;
            return(true);
        }
    }
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     Debug.LogWarning("skill_criticalTemplate 初始化");
     information            = new SkillInf(false, false, false, new List <string>());
     this.owner             = (BasicControler)owner;
     deleg._befCauseDamage += callback;
 }
Ejemplo n.º 5
0
    public override unitControler[] findTraget(Environment env)
    {
        List <BasicControler> Subs = new List <BasicControler>();

        foreach (BasicControler unit in ((ChessBoard)env).units)
        {
            if (unit.playerNo != owner.playerNo)
            {
                Subs.Add(unit);
            }
        }
        unitControler[] tragets;
        if (Subs.Count < 3)
        {
            tragets = new unitControler[Subs.Count];
        }
        else
        {
            tragets = new unitControler[3];
        }
        for (int i = 0; i < tragets.Length; i++)
        {
            int index = Randomer.main.getInt() % Subs.Count;
            tragets[i] = Subs[index];
            Subs.RemoveAt(index);
        }

        return(tragets);
    }
Ejemplo n.º 6
0
    public override unitControler[] findTraget(Environment env)
    {
        unitControler[]       tragets      = new unitControler[1];
        List <BasicControler> firstTragets = new List <BasicControler>();
        List <BasicControler> enemy        = new List <BasicControler>();

        foreach (BasicControler unit in ((ChessBoard)env).Units)
        {
            if (unit.playerNo != this.owner.playerNo)
            {
                enemy.Add(unit);
                if (unit.traget != owner)
                {
                    firstTragets.Add(unit);
                }
            }
        }
        if (firstTragets.Count != 0)
        {
            int index = Randomer.main.getInt() % firstTragets.Count;
            tragets[0] = firstTragets[index];
        }
        else if (enemy.Count != 0)
        {
            int index = Randomer.main.getInt() % enemy.Count;
            tragets[0] = enemy[index];
        }
        else
        {
            tragets = new unitControler[0];
        }
        return(tragets);
    }
Ejemplo n.º 7
0
    public unitControler[] getColOf(unitControler unit)
    {
        List <unitControler> list = new List <unitControler>();

        int[] pos = getPosFor(unit);
        Debug.Log("getPosFor:(" + pos[0] + "," + pos[1] + ")");
        int x = pos[0];

        if (pos[1] < Y / 2)
        {
            for (int y = Y / 2 - 1; y >= 0; y--)
            {
                if (board[y, x] != null)
                {
                    list.Add(board[y, x]);
                }
            }
        }
        else
        {
            for (int y = pos[1] + 1; y < Y; y++)
            {
                if (board[y, x] != null)
                {
                    list.Add(board[y, x]);
                }
            }
        }
        return(list.ToArray());
    }
Ejemplo n.º 8
0
 protected void onGetBuff_cb(Buff buff, unitControler creater)
 {
     if (_on_get_buff != null)
     {
         _on_get_buff(buff, creater);
     }
 }
Ejemplo n.º 9
0
 protected void onCreateBuff_cb(Buff buff, unitControler traget)
 {
     if (_on_create_buff != null)
     {
         _on_create_buff(buff, traget);
     }
 }
Ejemplo n.º 10
0
    public unitControler[] teammateOf(unitControler unit)
    {
        List <BasicControler> teammate = new List <BasicControler>();

        int[] pos = getPosFor(unit);
        if (pos[1] < Y / 2)
        {
            for (int y = 0; y < Y / 2; y++)
            {
                for (int x = 0; x < X; x++)
                {
                    if (board[y, x] != null)
                    {
                        teammate.Add((BasicControler)board[y, x]);
                    }
                }
            }
        }
        else
        {
            for (int y = Y / 2; y < Y; y++)
            {
                for (int x = 0; x < X; x++)
                {
                    if (board[y, x] != null)
                    {
                        teammate.Add((BasicControler)board[y, x]);
                    }
                }
            }
        }
        return(teammate.ToArray());
    }
Ejemplo n.º 11
0
 public Damage(int num, byte kind, unitControler creater, List <string> tags)
 {
     this.num     = num;
     this.kind    = kind;
     this.creater = creater;
     this.tag     = tags;
 }
Ejemplo n.º 12
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     deleg._BeAppoint += beAppoint;
     this.information  = new SkillInf(true, false, false, new List <string>()
     {
     });
 }
Ejemplo n.º 13
0
    public unitControler[] get3by3Of(unitControler unit)
    {
        List <unitControler> list = new List <unitControler>();

        int[] pos = getPosFor(unit);
        for (int y = pos[1] - 1; y <= pos[1] + 1; y++)
        {
            for (int x = pos[0] - 1; x <= pos[0] + 1; x++)
            {
                if (pos[1] < Y / 2)
                {
                    if (y < Y / 2 && y >= 0 && x >= 0 && x < X)//在player0的範圍內
                    {
                        if (board[y, x] != null)
                        {
                            list.Add(board[y, x]);
                        }
                    }
                }
                else
                {
                    if (y >= Y / 2 && y < Y && x >= 0 && x < X)//在player0的範圍內
                    {
                        if (board[y, x] != null)
                        {
                            list.Add(board[y, x]);
                        }
                    }
                }
            }
        }
        return(list.ToArray());
    }
Ejemplo n.º 14
0
    public unitControler[] unitsBehind(unitControler unit)
    {
        List <unitControler> list = new List <unitControler>();

        int[] pos = getPosFor(unit);
        if (pos[1] < Y / 2)
        {
            for (int y = pos[1] - 1; y >= 0; y--)
            {
                if (board[y, pos[0]] != null)
                {
                    list.Add(board[y, pos[0]]);
                }
            }
        }
        else
        {
            for (int y = pos[1] + 1; y < Y; y++)
            {
                if (board[y, pos[0]] != null)
                {
                    list.Add(board[y, pos[0]]);
                }
            }
        }
        return(list.ToArray());
    }
Ejemplo n.º 15
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     this.owner  = (BasicControler)owner;
     information = SkillInf.passiveSkillInf();
     ((BasicControler)owner).data.Now_Life_Recover += 2;
     deleg._BefUseSkill += befSkill;
 }
Ejemplo n.º 16
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     information = new SkillInf(false, false, false, new List <string>());
     this.owner  = (BasicControler)owner;
     this.owner.data.Now_Mag_Resistance += 25;
     deleg._onCreateBuff += onCreateBuff;
 }
Ejemplo n.º 17
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     data             = ((BasicControler)owner).data;
     this.information = new SkillInf(true, false, false, new List <string>()
     {
     });
     deleg._onHpChange += onHpChange;
 }
Ejemplo n.º 18
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     this.owner       = (BasicControler)owner;
     this.information = new SkillInf(true, true, false, new List <string>()
     {
         SkillInf.TAG_DAMAGE
     });
 }
Ejemplo n.º 19
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     base.onInit(owner, deleg);
     information = new SkillInf(false, true, false, new List <string>()
     {
         SkillInf.TAG_DAMAGE
     });
 }
Ejemplo n.º 20
0
    public unitControler removeAt(int pos_x, int pos_y)
    {
        unitControler unit = board[pos_y, pos_x];

        board[pos_y, pos_x] = null;
        units.Remove(unit);
        unit2pos.Remove(unit);
        return(unit);
    }
Ejemplo n.º 21
0
 public void onCreateBuff(Buff buff, unitControler creater)
 {
     //Debug.LogWarning("skill elem affinity name:"+buff.GetType().ToString());
     if (buff.GetType() == Type.GetType("buff_chill") || buff.GetType() == Type.GetType("buff_palsy") || buff.GetType() == Type.GetType("buff_burn"))
     {
         //Debug.LogWarning("屬於寒冷,麻痺,燃燒");
         buff.timeLeft *= 1.5f;
     }
 }
Ejemplo n.º 22
0
    protected override void ActionForTraget(unitControler traget)
    {
        Dictionary <string, object> args = new Dictionary <string, object>();

        args["layer"]   = 2;
        args["time"]    = 2.5f;
        args["creater"] = owner;
        traget.addBuff("buff_poison", args);
    }
Ejemplo n.º 23
0
    protected override void ActionForTraget(unitControler traget)
    {
        Dictionary <string, object> args = new Dictionary <string, object>();

        args["time"]    = 2f;
        args["layer"]   = 1;
        args["creater"] = owner;
        ((BasicControler)traget).addBuff("buff_chill", args);
    }
Ejemplo n.º 24
0
    public override void onInit(unitControler owner, Callback4Unit deleg)
    {
        Dictionary <string, object> buffArg = new Dictionary <string, object>();

        buffArg["time"]   = 4f;
        buffArg["number"] = 50;
        ((BasicControler)owner).addBuff("buff_Brisk", buffArg);
        information = SkillInf.passiveSkillInf();
    }
Ejemplo n.º 25
0
    public override bool onInit(unitControler unit, Buff[] Repetitive, Dictionary <string, object> args)
    {
        int selfLayer = (int)args["layer"];

        //Debug.Log("總共有" + Repetitive.Length + "個重複Buff");
        creater = (BasicControler)args["creater"];
        if (Repetitive.Length == 0)
        {
            layer = selfLayer;

            timeLeft  = (float)args["time"];
            this.unit = (BasicControler)unit;
            ((BasicControler)unit).data.Now_Attack_Speed       -= layer * ATK_SLOW_PER_LAYER;
            ((BasicControler)unit).data.Now_Cooldown_Reinforce -= layer * SKILL_SLOW_PER_LAYER;

            GameObject prefab = objectList.main.prafebList[26];
            effection = Instantiate(prefab, ((BasicControler)this.unit).transform);
            effection.transform.localPosition = prefab.transform.position;
            return(true);
        }
        else
        {
            buff_chill before = ((buff_chill)Repetitive[0]);
            if (before.layer > selfLayer)//之前的燃燒層數比較高
            {
                return(false);
            }
            else if (before.layer == selfLayer)
            {
                if (before.TimeLeft < (float)args["time"])
                {
                    before.timeLeft = (float)args["time"];
                    return(false);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                before.deleteSelf();

                layer = selfLayer;

                timeLeft  = (float)args["time"];
                this.unit = (BasicControler)unit;
                ((BasicControler)unit).data.Now_Attack_Speed       -= layer * ATK_SLOW_PER_LAYER;
                ((BasicControler)unit).data.Now_Cooldown_Reinforce -= layer * SKILL_SLOW_PER_LAYER;

                GameObject prefab = objectList.main.prafebList[26];
                effection = Instantiate(prefab, ((BasicControler)this.unit).transform);
                effection.transform.localPosition = prefab.transform.position;
                return(true);
            }
        }
    }
Ejemplo n.º 26
0
    public int[] getPosFor(unitControler unit)
    {
        int flatten = unit2pos[unit];
        int y       = flatten / X;
        int x       = flatten % X;

        return(new int[2] {
            x, y
        });
    }
Ejemplo n.º 27
0
    public abstract bool onInit(unitControler unit, Buff[] Repetitive, Dictionary <string, object> args); //如果角色身上已经有相同buff存在了则Repetitive将不为null,Repetitive会回传所有相同的buff

    //onInit的回传值为是否添加,如果回传false,该buff会被删掉而不触发onRemove
    public virtual void onIntarvel(unitControler unit, float timeBetween)
    {
        //Debug.Log("buff timeLeft:" + timeLeft);
        timeLeft -= timeBetween;
        if (timeLeft <= 0 && !endless)
        {
            //Debug.Log("觸發deleteSelf");
            deleteSelf();
        }
    }
Ejemplo n.º 28
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     this.owner       = (BasicControler)owner;
     this.information = new SkillInf(true, true, true, new List <string>()
     {
         SkillInf.TAG_DAMAGE
     });
     oriPos    = transform.position;
     effection = GetComponent <sp_effection>();
 }
Ejemplo n.º 29
0
 public override void onInit(unitControler owner, Callback4Unit deleg)
 {
     this.owner  = (BasicControler)owner;
     information = (SkillInf.passiveSkillInf());
     bonusAttack = gameObject.AddComponent <skill_BaseAttackRemote>();//skill_GunFu自己維護的遠程攻擊技能
     bonusAttack.onInit(owner, deleg);
     env = (ChessBoard)this.owner.env;
     deleg._BefUseSkill += befSkillUsed;
     deleg._AftUseSkill += aftSkillUsed;
 }
Ejemplo n.º 30
0
 public override void onIntarvel(unitControler unit, float timeBetween)
 {
     triggerLeft -= timeBetween;
     if (triggerLeft <= 0)
     {
         unit.heal(number, creater);
         triggerLeft = TIGGER_TIME;
     }
     base.onIntarvel(unit, timeBetween);
 }