public GameBattleUnit summonUnit(GameBattleUnit u, int id, int x, int y) { GameBattleUnit battleUnit = getUnitByID(id); if (battleUnit == null) { return(null); } if (battleUnit.IsShow || battleUnit.IsKilled) { return(null); } GameUnit unit = GameUnitData.instance.getData(battleUnit.UnitID); battleUnit.IsShow = true; battleUnit.IsSummon = true; GameUnitBase unitBaseU = u.getUnitBase(); GameUnitBase unitBase = battleUnit.getUnitBase(); unitBase.LV = unitBaseU.LV; unitBase.HP = (short)(unitBaseU.HP * unit.HP / 100.0f); unitBase.MP = (short)(unitBaseU.MP * unit.MP / 100.0f); unitBase.Str = (short)(unitBaseU.Str * unit.Str / 100.0f); unitBase.Vit = (short)(unitBaseU.Vit * unit.Vit / 100.0f); unitBase.Avg = (short)(unitBaseU.Avg * unit.Avg / 100.0f); unitBase.Int = (short)(unitBaseU.Int * unit.Int / 100.0f); unitBase.Luk = (short)(unitBaseU.Luk * unit.Luk / 100.0f); battleUnit.updateUnitData(); battleUnit.initHPMP(); battleUnit.clearMove(); battleUnit.setPos(x, y); battleUnit.updateAnimation(GameAnimationDirection.South); battleUnit.updateAlive(); return(battleUnit); }
public GameBattleUnit reliveSummonUnit(int x, int y) { GameBattleUnit unit = getKilledSummonUnit(); if (unit == null) { return(null); } unit.IsShow = true; unit.IsKilled = false; unit.addHP(1); unit.clearMove(); unit.setPos(x, y); unit.updateAnimation(GameAnimationDirection.South); unit.updateAlive(); return(unit); }