public Main(Ally ally, IEnumerable<MagicMenuEntry> spells, Menu.ScreenState screenState) : base(5, screenState.Height * 7 / 10 + 20, screenState.Width * 3 / 4, (screenState.Height * 5 / 20) - 25) { AssociatedAlly = ally; int magicSpellCount = AssociatedAlly.CurrentBattle.Seven.Data.MagicSpellCount; _totalRows = (magicSpellCount / COLUMNS) + ((magicSpellCount % COLUMNS == 0) ? 0 : 1); _spells = new MagicMenuEntry[_totalRows, COLUMNS]; foreach (MagicMenuEntry s in spells) { if (s.Spell.Name == "Toad") HasToad = true; _spells[s.Spell.Order / COLUMNS, s.Spell.Order % COLUMNS] = s; } Squish(); Reset(); }
private void DrawAllyStatus(Context g, Ally a, int y) { Color nameColor = Colors.WHITE; if (a.Death) { nameColor = Colors.TEXT_RED; } else if (a.NearDeath) { nameColor = Colors.TEXT_YELLOW; } Text.ShadowedText(g, nameColor, a.Name, X + x1, Y + y); }
public WeaponAttack(Ally ally) : this(ally, 1) { }
public WMagic(Ally ally, IEnumerable<MagicMenuEntry> spells, Menu.ScreenState screenState) : base(ally, spells, screenState) { }
public WeaponAttack(Ally ally, int hits) { Name = ""; Desc = ""; Type = AttackType.Physical; if (hits > 2) { Target = BattleTarget.GroupRandom; } else { Target = BattleTarget.Combatant; } Elements = new Element[] { ally.Weapon.Element }; Power = 16; Hitp = ally.Atkp; Hits = hits; DamageFormula = PhysicalAttack; HitFormula = PhysicalHit; }
private void DrawAllyStatus(Gdk.Drawable d, Cairo.Context g, Ally a, int y) { g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); string hp, hpmax, mp, mpmax, limit, time; TextExtents te; Color color; // slashes color = Colors.WHITE; te = g.TextExtents(SLASH); Text.ShadowedText(g, color, SLASH, X + x_hp_slash - te.Width, Y + y); Text.ShadowedText(g, color, SLASH, X + x_mp_slash - te.Width, Y + y); // HP if (a.Death) { color = Colors.TEXT_RED; } else if (a.NearDeath) { color = Colors.TEXT_YELLOW; } hp = a.HP.ToString(); te = g.TextExtents(hp); Text.ShadowedText(g, color, hp, X + x_hp - te.Width, Y + y); // MP color = Colors.WHITE; if (a.Death) { color = Colors.TEXT_RED; } else if (a.MP <= a.MaxMP / 8) { color = Colors.TEXT_YELLOW; } mp = a.MP.ToString(); te = g.TextExtents(mp); Text.ShadowedText(g, mp, X + x_mp - te.Width, Y + y); // HP MAX / MP MAX color = a.Death ? Colors.TEXT_RED : Colors.WHITE; hpmax = a.MaxHP.ToString(); te = g.TextExtents(hpmax); Text.ShadowedText(g, color, hpmax, X + x_hpmax - te.Width, Y + y); mpmax = a.MaxMP.ToString(); te = g.TextExtents(mpmax); Text.ShadowedText(g, mpmax, X + x_mpmax - te.Width, Y + y); // LIMIT color = Colors.WHITE; limit = "0%"; te = g.TextExtents(limit); Text.ShadowedText(g, limit, X + x_limit - te.Width + te.XBearing, Y + y); // TURN TIMER time = a.TurnTimer.PercentComplete + "%"; te = g.TextExtents(time); Text.ShadowedText(g, time, X + x_time - te.Width + te.XBearing, Y + y); }
protected override void InternalInit() { ScreenState state = new ScreenState { Width = Seven.Configuration.WindowWidth, Height = Seven.Configuration.WindowHeight }; _victoryEvent = new EndOfBattleEvent("Victory!"); _lossEvent = new EndOfBattleEvent("Annihilated!"); Screen = new BattleScreen(this, state); SpeedValue = (32768 / (120 + (Seven.Party.BattleSpeed * 15 / 8))); GlobalClock = new BattleClock(SpeedValue); Allies = new Ally[Party.PARTY_SIZE]; int[] e = _formation.GetAllyTurnTimersElapsed(Party); for (int i = 0; i < Party.PARTY_SIZE; i++) { if (Party[i] != null) { Allies[i] = new Ally(this, i, e[i]); Allies[i].InitMenu(state); } } if (Allies.All(a => a == null)) { throw new GameDataException("Must have at least one ally in battle."); } EnemyList = _formation.GetEnemyList(this); foreach (Ally ally in Allies) { if (ally != null) { CombatantClocks.Add(ally.TurnTimer); CombatantClocks.Add(ally.V_Timer); CombatantClocks.Add(ally.C_Timer); ally.TurnTimer.Unpause(); } } foreach (Enemy enemy in EnemyList) { CombatantClocks.Add(enemy.TurnTimer); CombatantClocks.Add(enemy.V_Timer); CombatantClocks.Add(enemy.C_Timer); enemy.EnterBattle(); } foreach (Enemy enemy in EnemyList) { enemy.TurnTimer.Unpause(); } }
public BattleMenu(Ally a, Menu.ScreenState screenState) : base(screenState.Width / 4, screenState.Height * 7 / 10 + 10, screenState.Width / 5, screenState.Height * 5 / 20 - 6) { AssociatedAlly = a; xs = screenState.Width / 5; Visible = false; ChangeMenuInstance = new ChangeMenu(this, screenState); // Always an option #region Item Menu foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "W-Item") { _witem = true; } } #endregion Item Menu // iterate through options int o = 0; #region Attack foreach (MateriaOrb m in a.Materia) { if (m != null) { if (m.Name == "Double Cut") { if (m.Level == 0) { _doubleCutOption2 = o; _doubleCutOption4 = -1; } else { _doubleCutOption4 = o; _doubleCutOption2 = -1; } _slashAllOption = -1; _flashOption = -1; } else if (m.Name == "Slash-All") { if (m.Level == 0) { _slashAllOption = o; _flashOption = -1; } else { _flashOption = o; _slashAllOption = -1; } _doubleCutOption2 = -1; _doubleCutOption4 = -1; } } } if (_doubleCutOption2 == -1 && _doubleCutOption4 == -1 && _slashAllOption == -1 && _flashOption == -1) { _attackOption = o; } o++; #endregion Attack // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Magic Menu int c = 0; foreach (MagicMenuEntry s in a.MagicSpells) { c++; } if (c > 0) { _magicMenuOption = o; o++; foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "W-Magic") { _wmagic = true; } } } #endregion Magic Menu // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Summon Menu c = 0; foreach (SummonMenuEntry s in a.Summons) { c++; } if (c > 0) { _summonMenuOption = o; o++; foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "W-Summon") { _wsummon = true; } } } #endregion Summon Menu // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Sense foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "Sense") { _senseOption = o; o++; } } #endregion // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Enemy Skill foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "Enemy Skill") { if (_enemySkillMenuOption < 0) { _enemySkillMenuOption = o; o++; } } } #endregion // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Mime foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "Mime") { _mimeOption = o; o++; break; } } #endregion // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Deathblow foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "Deathblow") { _deathblowOption = o; o++; break; } } #endregion // put this after every one in order to skip the Item option if (o == 3) { o++; } #region Steal foreach (MateriaOrb m in a.Materia) { if (m != null && m.Name == "Steal") { if (m.Level == 0) { _stealOption = o; _mugOption = -1; } else { _mugOption = o; _stealOption = -1; } } } if (_mugOption != -1 || _stealOption != -1) { o++; } #endregion // put this after every one in order to skip the Item option if (o == 3) { o++; } _columns = (o - 1) / _rows + 1; if (_columns != 1) { Width = W * _columns; } }
public void UseInBattle(Ally source, IEnumerable<Combatant> targets) { targets.Count(); if (CanUseInBattle) { try { switch (BattleUsage.Target) { case BattleTarget.Combatant: case BattleTarget.Ally: case BattleTarget.Enemy: BattleUsage.Use.Call(source, targets.First()); break; case BattleTarget.Area: case BattleTarget.AreaRandom: case BattleTarget.Group: case BattleTarget.GroupRandom: case BattleTarget.Allies: case BattleTarget.AlliesRandom: case BattleTarget.Enemies: case BattleTarget.EnemiesRandom: BattleUsage.Use.Call(source, targets.ToList()); break; } } catch (Exception e) { throw new ImplementationException("Error calling battle script; id = " + ID, e); } } else { throw new ImplementationException("Tried to use an item in battle that can't be used in battle."); } }