public void show(GameBattleUnit unit, bool top) { show(); #if (UNITY_ANDROID || UNITY_IPHONE) top = true; #endif trans.anchoredPosition = top ? new Vector2(0.0f, 166.0f + GameCanvasScale.instance.Height - GameDefine.SCENE_HEIGHT) : Vector2.zero; attack.text = GameDefine.getBigInt(unit.PhysicalAttack.ToString()); defence.text = GameDefine.getBigInt(unit.Defence.ToString()); lv.text = GameDefine.getBigInt(unit.LV.ToString()); exp.text = GameDefine.getBigInt(unit.EXP.ToString()); effect0.SetActive(unit.checkEffect(GameSkillResutlEffect.StrUp)); effect1.SetActive(unit.checkEffect(GameSkillResutlEffect.VitUp)); effect2.SetActive(unit.checkEffect(GameSkillResutlEffect.IntUp)); effect3.SetActive(unit.checkEffect(GameSkillResutlEffect.MoveUp)); showFade(); }
public bool selectUnit() { selectionUnit = GameBattleUnitManager.instance.getUnit(GameBattleCursor.instance.PosX, GameBattleCursor.instance.PosY); if (selectionUnit == null) { return(false); } GameUnitMove unitMove = GameUnitMoveTypeData.instance.getData(selectionUnit.MoveType); bool fly = selectionUnit.checkEffect(GameSkillResutlEffect.Under) ? true : unitMove.fly; if (selectionUnit.IsUser || selectionUnit.IsNpc) { // user GameBattleUnitMovement.instance.show((short)selectionUnit.PosX, (short)selectionUnit.PosY, selectionUnit.IsNpc || selectionUnit.IsActed ? selectionUnit.MoveMax : selectionUnit.Move, selectionUnit.MoveType, fly, selectionUnit.UnitCampType, true); if (selectionUnit.IsActed) { // show info ui // selectionUnit = null; } } else { GameBattleUnitMovement.instance.show((short)selectionUnit.PosX, (short)selectionUnit.PosY, selectionUnit.MoveMax, selectionUnit.MoveType, fly, selectionUnit.UnitCampType, false); } return(true); }
public void updateData(GameBattleUnit battleUnit) { clear(); GameUnit gameUnit = GameUnitData.instance.getData(battleUnit.UnitID); transHP.anchoredPosition = new Vector2(-2.0f, 0.0f); transMP.anchoredPosition = new Vector2(-2.0f, 0.0f); transHP.anchoredPosition = new Vector2(-2.0f - 75.0f * (1.0f - (float)battleUnit.HP / battleUnit.HPMax), 0.0f); if (battleUnit.MPMax > 0) { transMP.anchoredPosition = new Vector2(-2.0f - 75.0f * (1.0f - (float)battleUnit.MP / battleUnit.MPMax), 0.0f); } nameText.text = gameUnit.Name; lvText.text = GameDefine.getBigInt(battleUnit.LV.ToString()); moveText.text = GameDefine.getBigInt(battleUnit.Move.ToString()); moveMaxText.text = GameDefine.getBigInt(battleUnit.MoveMax.ToString()); hpText.text = GameDefine.getBigInt(battleUnit.HP.ToString(), true); hpMaxText.text = GameDefine.getBigInt(battleUnit.HPMax.ToString(), true); mpText.text = GameDefine.getBigInt(battleUnit.MP.ToString(), true); mpMaxText.text = GameDefine.getBigInt(battleUnit.MPMax.ToString(), true); strText.text = GameDefine.getBigInt(battleUnit.Str.ToString()); intText.text = GameDefine.getBigInt(battleUnit.Int.ToString()); vitText.text = GameDefine.getBigInt(battleUnit.Vit.ToString()); avgText.text = GameDefine.getBigInt(battleUnit.Avg.ToString()); lukText.text = GameDefine.getBigInt(battleUnit.Luk.ToString()); image[0].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.StrUp)); image[1].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.VitUp)); image[2].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.IntUp)); image[3].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.MoveUp)); image[4].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.PhyImmunity)); image[5].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.MagImmunity)); image[6].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Violent)); image[7].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Palsy)); image[8].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Fetter)); image[9].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Silence)); image[10].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Miss)); image[11].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.Poison)); image[12].gameObject.SetActive(battleUnit.checkEffect(GameSkillResutlEffect.SummonKiller)); for (int i = 0; i < (int)GameSpiritType.Count; i++) { powerText[i].text = GameDefine.getBigInt(battleUnit.SpiritPower[i].ToString()); int f = (int)(battleUnit.SpiritPower[i] / 10.0f); if (battleUnit.SpiritPower[i] % 10 > 0) { f += 1; } if (f > 10) { f = 10; } if (battleUnit.SpiritPower[i] > 0) { power[i].showFrame(3 + f); } } }
void updateActionUI() { if (!GameBattleUnitActionUI.instance.IsShow) { return; } if (confirm) { confirm = false; GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit; if (unit != null) { switch (GameBattleUnitActionUI.instance.Selection) { case 0: { GameBattleCursor.instance.show(); GameBattleUnitActionUI.instance.unShowFade(); unit.burst(); GameBattleSelection.instance.clearSelection(); } break; case 1: { GameBattleCursor.instance.unShow(); GameBattleUnitActionUI.instance.unShowFade(); GameBattleSkillUI.instance.show(); GameBattleSkillUI.instance.setData(unit); GameBattleSkillUI.instance.showFade(); } break; case 2: { if (unit.checkEffect(GameSkillResutlEffect.Palsy)) { return; } GameBattleCursor.instance.show(); GameBattleUnitActionUI.instance.unShowFade(); GameBattleUnitAttackSelection.instance.show(unit.PosX, unit.PosY, unit.Weapon, unit.UnitCampType, true); GameBattleCursor.instance.moveTo(GameBattleUnitAttackSelection.instance.AttackCell.x, GameBattleUnitAttackSelection.instance.AttackCell.y, GameBattleCursor.SpeedX, GameBattleCursor.SpeedY, true, onCursorMoveOver); } break; case 3: { GameBattleUnitActionItemUI.instance.show(GameBattleCursor.instance.PosX, GameBattleCursor.instance.PosY); GameBattleUnitActionItemUI.instance.showFade(); GameBattleUnitActionUI.instance.enable(false); } break; case 4: { GameBattleCursor.instance.show(); GameBattleUnitActionUI.instance.unShowFade(); unit.action(); GameBattleSelection.instance.clearSelection(); } break; } } } if (cancel) { cancel = false; GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit; GameBattleUnitAttackSelection.instance.unShow(); GameBattleUnitActionUI.instance.unShowFade(); GameBattleCursor.instance.show(); if (unit != null) { GameBattleCursor.instance.moveTo(unit.PosX, unit.PosY, true); } GameBattleSelection.instance.clearSelection(); } moveBattleUnitActionUI(); }
public bool checkSkillAI(GameBattleUnit unit1, GameBattleUnit unit, GameSkill sk, GameUnitCampType camp) { switch (sk.TargetType) { case GameTargetType.User: { if (unit == null || unit.UnitCampType != camp) { return(false); } switch (sk.ResultType) { case GameSkillResutlType.Damage: break; case GameSkillResutlType.Cure: { if (unit.HPMax - unit.HP > sk.BasePower || (unit.HP / (float)unit.HPMax) < 0.4f) { return(true); } return(false); } case GameSkillResutlType.Purge: { if (unit.checkEffect(GameSkillResutlEffect.Poison) || unit.checkEffect(GameSkillResutlEffect.Palsy) || unit.checkEffect(GameSkillResutlEffect.Silence) || unit.checkEffect(GameSkillResutlEffect.Fetter)) { return(true); } return(false); } case GameSkillResutlType.Blessing: { if (unit.checkEffect(sk.ResultEffect)) { return(false); } checkUnitAI = true; return(true); } case GameSkillResutlType.Curse: break; case GameSkillResutlType.None: case GameSkillResutlType.Special: { switch (sk.OtherEffect) { case GameSkillOtherEffect.Invincible0: { if (unit.checkEffect(GameSkillResutlEffect.PhyImmunity)) { return(false); } checkUnitAI = true; return(true); } case GameSkillOtherEffect.Invincible1: { if (unit.checkEffect(GameSkillResutlEffect.MagImmunity)) { return(false); } checkUnitAI = true; return(true); } case GameSkillOtherEffect.HealAll: { if (unit.HPMax - unit.HP > sk.BasePower || (unit.HP / (float)unit.HPMax) < 0.4f) { return(true); } return(false); } case GameSkillOtherEffect.MPAdd: { if (unit.MPMax - unit.MP > sk.BasePower || (unit.MP / (float)unit.MPMax) < 0.4f) { return(true); } return(false); } case GameSkillOtherEffect.AbilityUp: { if (unit.checkEffectOther(GameSkillOtherEffect.AbilityUp)) { return(false); } checkUnitAI = true; return(true); } } switch (sk.ResultEffect) { case GameSkillResutlEffect.Clear: break; case GameSkillResutlEffect.PhyImmunity: case GameSkillResutlEffect.MagImmunity: case GameSkillResutlEffect.Miss: case GameSkillResutlEffect.SummonKiller: case GameSkillResutlEffect.Under: { if (unit.checkEffect(sk.ResultEffect)) { return(false); } checkUnitAI = true; return(true); } } } break; } } break; case GameTargetType.Enemy: { if (unit == null || unit.UnitCampType == camp) { return(false); } if (sk.Type == GameSkillType.Physical) { return(true); } switch (sk.ResultType) { case GameSkillResutlType.Damage: { return(true); } case GameSkillResutlType.Cure: break; case GameSkillResutlType.Purge: break; case GameSkillResutlType.Blessing: break; case GameSkillResutlType.Curse: { if (unit.checkEffect(sk.ResultEffect)) { return(false); } return(true); } case GameSkillResutlType.None: case GameSkillResutlType.Special: { switch (sk.OtherEffect) { case GameSkillOtherEffect.AttackX2: case GameSkillOtherEffect.AttackX3: case GameSkillOtherEffect.AttackX4: case GameSkillOtherEffect.AttackPalsy: case GameSkillOtherEffect.AttackPoison: case GameSkillOtherEffect.AttackHP: case GameSkillOtherEffect.AttackFetter: case GameSkillOtherEffect.MP: { return(true); } case GameSkillOtherEffect.KillSelf: { return(((float)unit1.HP / unit1.HPMax) <= 0.5f); } case GameSkillOtherEffect.AttackSilence: { if (unit.checkEffect(GameSkillResutlEffect.Silence)) { return(false); } return(true); } case GameSkillOtherEffect.AbilityDown: { if (unit.checkEffect(GameSkillResutlEffect.StrUp) || unit.checkEffect(GameSkillResutlEffect.VitUp) || unit.checkEffect(GameSkillResutlEffect.IntUp) || unit.checkEffect(GameSkillResutlEffect.MoveUp) || unit.checkEffect(GameSkillResutlEffect.Violent)) { return(true); } return(false); } case GameSkillOtherEffect.HealAll: case GameSkillOtherEffect.AbilityUp: case GameSkillOtherEffect.Invincible0: case GameSkillOtherEffect.Invincible1: break; } switch (sk.ResultEffect) { case GameSkillResutlEffect.Clear: { if (unit.checkEffect(GameSkillResutlEffect.StrUp) || unit.checkEffect(GameSkillResutlEffect.VitUp) || unit.checkEffect(GameSkillResutlEffect.IntUp) || unit.checkEffect(GameSkillResutlEffect.MoveUp) || unit.checkEffect(GameSkillResutlEffect.Violent)) { return(true); } return(false); } case GameSkillResutlEffect.PhyImmunity: case GameSkillResutlEffect.MagImmunity: case GameSkillResutlEffect.Miss: case GameSkillResutlEffect.SummonKiller: case GameSkillResutlEffect.Under: { } break; } } break; } } break; case GameTargetType.Summon: { if (unit != null) { return(false); } return(true); } } return(false); }
public void canAttackAI(GameBattleUnit unit1, int ux, int uy, int x, int y, GameSkill sk, GameUnitCampType camp, int id) { targetID = id; IsAttackUnits = false; checkUnitAI = false; list.Clear(); int width = GameBattleManager.instance.Width; int height = GameBattleManager.instance.Height; int min = (sk.AttackRangeMin == GameDefine.INVALID_ID ? 1 : sk.AttackRangeMin + 1); int max = sk.AttackRangeMax; if (min > max) { min = max; } rangeType = sk.AttackRangeType; posX = x; posY = y; switch (rangeType) { case GameAttackRangeType.Circle: { for (int i = -max; i <= max; i++) { for (int j = -max; j <= max; j++) { int xx = Mathf.Abs(j); int yy = Mathf.Abs(i); if (xx + yy <= max && xx + yy >= min) { Cell cell = new Cell(); cell.x = x + j; cell.y = y + i; list.Add(cell); } } } if (sk.AttackRangeMin == 0) { Cell cell = new Cell(); cell.x = x; cell.y = y; list.Add(cell); } for (int i = 0; i < list.Count; i++) { if (list[i].x < 0 || list[i].y < 0 || list[i].x >= width || list[i].y >= height) { continue; } getUnitsCircleAI(unit1, ux, uy, x, y, list[i].x, list[i].y, sk, camp); } } break; case GameAttackRangeType.Line: { getUnitsLineAI(unit1, ux, uy, sk, camp); } break; } if (checkUnitAI) { for (int i = 0; i < attackUnits.Count; i++) { GameBattleUnit unit = attackUnits[i]; GameUnitMove unitMove = GameUnitMoveTypeData.instance.getData(unit.MoveType); bool fly = unit.checkEffect(GameSkillResutlEffect.Under) ? true : unitMove.fly; List <GameBattleUnitMovement.Cell> cells = GameBattleUnitMovement.instance.getMoveList( unit.PosX, unit.PosY, unit.Move, unit.MoveType, fly, unit.UnitCampType); for (int j = 0; j < cells.Count; j++) { GameBattleUnit u = GameBattleUnitAttackSelection.instance.canAttack( cells[j].x, cells[j].y, unit.Weapon, unit.UnitCampType); if (u != null) { return; } } } list.Clear(); attackUnits.Clear(); } }