public Main(SevenBattleState battleState, EnemySkillMateria esm, Menu.ScreenState screenState) : base( 5, screenState.Height * 7 / 10 + 20, screenState.Width * 3 / 4, (screenState.Height * 5 / 20) - 25) { BattleState = battleState; int enemySkillCount = battleState.Seven.Data.EnemySkillCount; _totalRows = (enemySkillCount / COLUMNS) + ((enemySkillCount % COLUMNS == 0) ? 0 : 1); _spells = new Spell[_totalRows, COLUMNS]; for (int i = 0; i < enemySkillCount; i++) { if (((esm.AP >> i) & 1) > 0) { Spell s = battleState.Seven.Data.GetEnemySkill(esm.Abilities.ElementAt(i)); _spells[s.Order / COLUMNS, s.Order % COLUMNS] = s; } } Reset(); }
internal void InitMenu(ScreenState state) { BattleMenu = new BattleMenu(this, state); if (BattleMenu.WMagic) { MagicMenu = new Screens.Magic.WMagic(this, MagicSpells, state); } else { MagicMenu = new Screens.Magic.Main(this, MagicSpells, state); } if (!MagicMenu.IsValid) { MagicMenu = null; } if (BattleMenu.WSummon) { SummonMenu = new Screens.Summon.WSummon(CurrentBattle, Summons, state); } else { SummonMenu = new Screens.Summon.Main(CurrentBattle, Summons, state); } if (!SummonMenu.IsValid) { SummonMenu = null; } IEnumerable <EnemySkillMateria> esms = Materia.Where(x => x is EnemySkillMateria).Cast <EnemySkillMateria>(); if (esms.Count() > 0) { EnemySkillMateria m = EnemySkillMateria.Merge(esms); if (m.AP > 0) { EnemySkillMenu = new Screens.EnemySkill.Main(CurrentBattle, m, state); } } }
public MateriaOrb GetMateria(string name, int ap) { MateriaOrb materia = null; if (name == EnemySkillMateria.NAME) { materia = new EnemySkillMateria(ap, this); } else if (name == "Master Magic") { materia = new MasterMateria(MateriaType.Magic, this); } else if (name == "Master Command") { materia = new MasterMateria(MateriaType.Command, this); } else if (name == "Master Summon") { materia = new MasterMateria(MateriaType.Summon, this); } else { XmlDocument gamedata = Resource.GetXmlFromResource("data.materia.xml", Assembly); XmlNode node = gamedata.SelectSingleNode(String.Format("//materia[name = '{0}']", name)); if (node == null) { throw new GameDataException("Could not find materia with name " + name); } materia = new MateriaOrb(node, Lua); materia.AddAP(ap); } return(materia); }
protected override void DrawContents(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged) { g.SelectFontFace(Text.MONOSPACE_FONT, FontSlant.Normal, FontWeight.Bold); g.SetFontSize(24); TextExtents te; MateriaOrb orb = MenuState.MateriaTop.Selection; if (orb == null) { orb = MenuState.MateriaList.Selection; } if (orb != null) { Shapes.RenderCircle(g, Colors.WHITE, 9, X + x1, Y + yp); Shapes.RenderCircle(g, orb.Color, 7, X + x1, Y + yp); Text.ShadowedText(g, orb.Name, X + x2, Y + y0); Cairo.Color greenish = Colors.TEXT_TEAL; Cairo.Color yellow = Colors.TEXT_YELLOW; Cairo.Color red = Colors.TEXT_RED; if (orb is EnemySkillMateria) { EnemySkillMateria esm = (EnemySkillMateria)orb; string mask = ""; for (int i = 0; i < MenuState.Seven.Data.EnemySkillCount; i++) { mask += ((esm.AP >> i) & 1) > 0 ? "1" : "0"; } Text.ShadowedText(g, mask, X + x1, Y + y3); } else { string lvl = (orb.Level + 1).ToString() + "/"; te = g.TextExtents(lvl); Text.ShadowedText(g, lvl, X + x6 - te.Width, Y + y0); string lvls = orb.Tiers.Length.ToString(); te = g.TextExtents(lvls); Text.ShadowedText(g, lvls, X + x7 - te.Width, Y + y0); te = g.TextExtents("Level"); Text.ShadowedText(g, greenish, "Level", X + x5 - te.Width, Y + y0); string ap; if (orb.AP < orb.Tiers[orb.Tiers.Length - 1]) { ap = orb.AP.ToString(); } else { ap = "MASTER"; } te = g.TextExtents(ap); Text.ShadowedText(g, ap, X + x7 - te.Width, Y + y1); te = g.TextExtents("AP"); Text.ShadowedText(g, greenish, "AP", X + x5 - te.Width, Y + y1); string nxt; if (orb.Master) { nxt = "0"; } else { nxt = (orb.Tiers[orb.Level + 1] - orb.AP).ToString(); } te = g.TextExtents(nxt); Text.ShadowedText(g, nxt, X + x7 - te.Width, Y + y2); te = g.TextExtents("To next level"); Text.ShadowedText(g, greenish, "To next level", X + x5 - te.Width, Y + y2); Text.ShadowedText(g, greenish, "Ability List", X + x0, Y + y3); int k = 0; foreach (string s in orb.AbilityDescriptions) { if (!String.IsNullOrEmpty(s)) { Color abilityTextColor = Colors.GRAY_4; if (orb is MasterMateria || orb.Abilities.Contains(s)) { abilityTextColor = Colors.WHITE; } Text.ShadowedText(g, abilityTextColor, s, X + x1, Y + y4 + (ys * k)); k++; } } Text.ShadowedText(g, greenish, "Equip Effect", X + x4, Y + y3); int i = 0; string stat; te = g.TextExtents("-"); double dashw = te.Width; te = g.TextExtents("+"); double plusw = te.Width; #region Strength if (orb.StrengthMod != 0) { Text.ShadowedText(g, "Str", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.StrengthMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.StrengthMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Strength #region Vitality if (orb.VitalityMod != 0) { Text.ShadowedText(g, "Vit", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.VitalityMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.VitalityMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Vitality #region Dexterity if (orb.DexterityMod != 0) { Text.ShadowedText(g, "Dex", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.DexterityMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.DexterityMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Dexterity #region Magic if (orb.MagicMod != 0) { Text.ShadowedText(g, "Mag", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.MagicMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.MagicMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Magic #region Spirit if (orb.SpiritMod != 0) { Text.ShadowedText(g, "Spr", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.SpiritMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.SpiritMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Spirit #region Luck if (orb.LuckMod != 0) { Text.ShadowedText(g, "Lck", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.LuckMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } te = g.TextExtents(stat); if (orb.LuckMod < 0) { Text.ShadowedText(g, "-", X + x7 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x7 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x7 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion Luck #region HP if (orb.HPMod != 0) { Text.ShadowedText(g, "MaxHP", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.HPMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } stat = stat + "%"; te = g.TextExtents(stat); if (orb.HPMod < 0) { Text.ShadowedText(g, "-", X + x8 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x8 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x8 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x8 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion HP #region MP if (orb.MPMod != 0) { Text.ShadowedText(g, "MaxMP", X + x5, Y + y4 + (ys * i)); stat = Math.Abs(orb.MPMod).ToString(); if (stat.Length < 2) { stat = "0" + stat; } stat = stat + "%"; te = g.TextExtents(stat); if (orb.MPMod < 0) { Text.ShadowedText(g, "-", X + x8 - te.Width - dashw, Y + y4 + (ys * i)); Text.ShadowedText(g, red, stat, X + x8 - te.Width, Y + y4 + (ys * i)); } else { Text.ShadowedText(g, "+", X + x8 - te.Width - plusw, Y + y4 + (ys * i)); Text.ShadowedText(g, yellow, stat, X + x8 - te.Width, Y + y4 + (ys * i)); } i++; } #endregion MP } } }