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); } }
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(); }
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; }
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); }
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); }
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()); }
protected void onGetBuff_cb(Buff buff, unitControler creater) { if (_on_get_buff != null) { _on_get_buff(buff, creater); } }
protected void onCreateBuff_cb(Buff buff, unitControler traget) { if (_on_create_buff != null) { _on_create_buff(buff, traget); } }
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()); }
public Damage(int num, byte kind, unitControler creater, List <string> tags) { this.num = num; this.kind = kind; this.creater = creater; this.tag = tags; }
public override void onInit(unitControler owner, Callback4Unit deleg) { deleg._BeAppoint += beAppoint; this.information = new SkillInf(true, false, false, new List <string>() { }); }
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()); }
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()); }
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; }
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; }
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; }
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 }); }
public override void onInit(unitControler owner, Callback4Unit deleg) { base.onInit(owner, deleg); information = new SkillInf(false, true, false, new List <string>() { SkillInf.TAG_DAMAGE }); }
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); }
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; } }
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); }
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); }
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(); }
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); } } }
public int[] getPosFor(unitControler unit) { int flatten = unit2pos[unit]; int y = flatten / X; int x = flatten % X; return(new int[2] { x, y }); }
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(); } }
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>(); }
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; }
public override void onIntarvel(unitControler unit, float timeBetween) { triggerLeft -= timeBetween; if (triggerLeft <= 0) { unit.heal(number, creater); triggerLeft = TIGGER_TIME; } base.onIntarvel(unit, timeBetween); }