public static void InitiateCombat(BaseCharacter g, BaseCharacter r, BasicAbility gca, BasicAbility rca) { bMods.Clear(); foreach (var item in Enum.GetNames(typeof(BattleMods))) { bMods.Add(0); } castAbility = gca; giver = g; receiver = r; // giverAS.DefaultStatChart(); // receiverAS.DefaultStatChart(); giverAS = g.trueSTATChart(); receiverAS = r.trueSTATChart(); Console.WriteLine(g.trueSTATChart().currentActiveStats[(int)STATChart.ACTIVESTATS.SHIELD]); if (gca.abilityType == (int)BasicAbility.ABILITY_TYPE.ATTACK) { bMods[(int)BattleMods.MIN_DAMAGE] = CalculateMinDamage(); bMods[(int)BattleMods.MAX_DAMAGE] = CalculateMaxDamage(); bMods[(int)BattleMods.MIN_STATUS_CHANCE] = 0; bMods[(int)BattleMods.MAX_STATUS_CHANCE] = 0; bMods[(int)BattleMods.CRIT] = 5; bMods[(int)BattleMods.DODGE] = 5; bMods[(int)BattleMods.FAIL] = 5; } BattleGUI.Start(giverAS, receiverAS, g, r, gca, rca); }
public static KeyValuePair <List <int>, List <int> > CalculateDamage(BaseCharacter g, BaseCharacter r, BasicAbility gca, BasicAbility rca) { BasicAbility Idle = new BasicAbility(); Idle.abilityName = "Idle"; castAbility = gca; giver = g; receiver = r; giverAS = g.trueSTATChart(); giverAS = giverAS.StatChartAddition(gca.abilityModifier); receiverAS = r.trueSTATChart(); List <int> giverDMG = new List <int>(); List <int> targetDMG = new List <int>(); if (gca.abilityType == (int)BasicAbility.ABILITY_TYPE.ATTACK) { giverDMG.Add(CalculateMinDamage()); giverDMG.Add(CalculateMaxDamage()); targetDMG.Add(0); targetDMG.Add(0); } return(new KeyValuePair <List <int>, List <int> >(giverDMG, targetDMG)); }
static public void ProcessAbilityCastByHero(BaseCharacter hero, BasicAbility ba) { if (ba.bAbilityHasDebuff && !hero.bIsAI) { DebuffsAppliedThisFight[partyMembers.IndexOf(hero)] += 1; } }
internal static KeyValuePair <List <int>, List <int> > CalculateHealing(BaseCharacter g, BaseCharacter r, BasicAbility gca, BasicAbility rca) { BasicAbility Idle = new BasicAbility(); Idle.abilityName = "Idle"; castAbility = gca; giver = g; receiver = r; giverAS = g.trueSTATChart(); giverAS = giverAS.StatChartAddition(gca.abilityModifier); receiverAS = r.trueSTATChart(); List <int> giverDMG = new List <int>(); List <int> targetDMG = new List <int>(); if (gca.abilityType == (int)BasicAbility.ABILITY_TYPE.SUPPORT) { giverDMG.Add(-(g.trueSTATChart().currentActiveStats[(int)STATChart.ACTIVESTATS.HP])); giverDMG.Add(-(g.trueSTATChart().currentActiveStats[(int)STATChart.ACTIVESTATS.HP] + g.trueSTATChart().currentActiveStats[(int)STATChart.ACTIVESTATS.HP] / 2)); targetDMG.Add(0); targetDMG.Add(0); } return(new KeyValuePair <List <int>, List <int> >(giverDMG, targetDMG)); }
public void Add(BasicAbility ba) { if (!abilities.Contains(ba) && abilities.Find(abi => abi.abilityIdentifier == ba.abilityIdentifier) == null) { abilityIDs.Add(ba.abilityIdentifier); abilities.Add(ba); } }
public void Remove(BasicAbility ba) { if ((abilities.Find(abi => abi.abilityIdentifier == ba.abilityIdentifier) != null) && abilities.Count > 1) { int index = abilities.IndexOf(abilities.Find(abi => abi.abilityIdentifier == ba.abilityIdentifier)); abilityIDs.RemoveAt(index); abilities.RemoveAt(index); } }
public bool CanAddAbility(BasicAbility ba) { if (abilities.Contains(ba)) { return(false); } if (abilities.Count < amount) { return(true); } return(false); }
public void ReloadDefaultAIAbility(GameContentDataBase gcdb, EnemyAIInfo AII) { defaultAbilityID = AII.defaultAIAbilityID; try { AIDefaultAttack = gcdb.gameAbilities.Find(abi => abi.abilityIdentifier == defaultAbilityID).Clone(); } catch (Exception) { Console.WriteLine("Error generating default ability info for" + AII.ToString()); AIDefaultAttack = new BasicAbility(); } }
internal float baseVSModifier(BasicAbility ba) { BasicAbility.ABILITY_AFFINITY affinity = ba.affinity; var temp = affinityEffects.Find(aff => aff.parent == affinity); if (temp != null) { return(temp.modifier); } else { return(AffinityCounter(affinity)); } }
internal AbilitySelectTab(BasicAbility ba, Rectangle containerPanel, int index) { if (!bInitialize) { Initialize(); } parent = ba; this.index = index; positionOnscreen = new Rectangle(containerPanel.X, containerPanel.Y + index * renderSize.Height + index * verticalSpacing, renderSize.Width, renderSize.Height); drawPositionOnscreen = new Rectangle(0, 0 + index * renderSize.Height + index * verticalSpacing, renderSize.Width, renderSize.Height); render = new RenderTarget2D(Game1.graphics.GraphicsDevice, renderSize.Width, renderSize.Height); }
public BasicAbility Clone() { BasicAbility temp = (BasicAbility)this.MemberwiseClone(); temp.abilityIcon = abilityIcon.Clone(); temp.statModifier = statModifier.Clone(); temp.EnemyStatModifier = EnemyStatModifier.Clone(); temp.abilityModifier = abilityModifier.Clone(); //temp.AbilityManaCost = new List<int>(AbilityManaCost); //temp.AbilityAPCost = new List<int>(AbilityAPCost); //temp.AbilityHitChance = new List<int>(AbilityHitChance); //temp.AbilityCritChance = new List<int>(AbilityCritChance); temp.abiAOEM = abiAOEM.Clone(); temp.abiAOEMAS = abiAOEMAS.Clone(); temp.targetableTypes = new List <BaseClass.CLASSType>(targetableTypes); //temp.abilityDescription = ""; return(temp); }
internal AbilitySelectDescription(BaseCharacter bc, BasicAbility ba, Rectangle screenPos) { if (bInitialize) { Initialize(); } parent = ba; // GameProcessor.gcDB drawOnScreen = screenPos; pos = new Rectangle(new Point(), screenPos.Size); render = new RenderTarget2D(Game1.graphics.GraphicsDevice, pos.Width, pos.Height); panel = new TexPanel(guiTex, pos, new Rectangle(90, 679, 64, 2), new Rectangle(90, 745, 64, 2), new Rectangle(88, 681, 2, 64), new Rectangle(154, 681, 2, 64), new Rectangle(88, 679, 2, 2), new Rectangle(154, 679, 2, 2), new Rectangle(88, 745, 2, 2), new Rectangle(154, 745, 2, 2), new Rectangle(90, 681, 64, 64)); startUpTimer = new TimingUtility(16, true, StartUpTimer); startUpTimer.SetStepTimer(startUpStepTimer); titleBox = new Rectangle(offsetPanel, offsetPanel, render.Width - 2 * offsetPanel, titleBoxHeight); descriptionBox = new Rectangle(titleBox.Location + new Point(0, titleBoxHeight + offsetBoxes), new Point(render.Width - 2 * offsetPanel)); aoeBox = new Rectangle(new Point(0, descriptionBox.Y + descriptionBox.Height + offsetBoxes), new Point(render.Width - 2 * offsetPanel)); potencyText = ba.GetEstimatedPotency(bc); }
internal static KeyValuePair <BasicTile, BasicAbility> returnFavoredAttackAndPosition(KeyValuePair <List <List <BasicTile> >, List <BasicAbility> > llbtlba, BaseCharacter caster, BaseCharacter target) { List <BasicAbility> listOfNonDefaultAbilities = llbtlba.Value.FindAll(ba => !ba.abilityName.Equals(caster.CCC.AIDefaultAttack.abilityName) && ba.IsAbilityAvailable(caster.trueSTATChart())); BasicAbility randomNonDefaultAbility = new BasicAbility(); BasicAbility finalAbility = null; if (listOfNonDefaultAbilities.Count != 0) { randomNonDefaultAbility = listOfNonDefaultAbilities[GamePlayUtility.Randomize(0, listOfNonDefaultAbilities.Count)]; int randomChance = GamePlayUtility.Randomize(0, 101); if (randomChance <= randomNonDefaultAbility.castChance) { finalAbility = randomNonDefaultAbility; } } if (finalAbility == default(BasicAbility) && llbtlba.Value.Find(ba => ba.abilityIdentifier == caster.CCC.AIDefaultAttack.abilityIdentifier) != default(BasicAbility)) { finalAbility = caster.CCC.AIDefaultAttack; } else { finalAbility = listOfNonDefaultAbilities[GamePlayUtility.Randomize(0, listOfNonDefaultAbilities.Count - 1)]; } Console.WriteLine(llbtlba.Value.IndexOf(llbtlba.Value.Find(ba => ba.abilityName.Equals(finalAbility.abilityName)))); if (llbtlba.Value.Count == 0 && llbtlba.Key.Count != 0) { while (llbtlba.Value.Count != llbtlba.Key.Count) { llbtlba.Value.Add(finalAbility); } } //if(!finalAbility.abilityName.Equals(llbtlba.Value[0].abilityName, StringComparison.OrdinalIgnoreCase)) //{ // finalAbility = llbtlba.Value[0]; //} List <BasicTile> AbilityLocationList = llbtlba.Key[llbtlba.Value.IndexOf(llbtlba.Value.Find(ba => ba.abilityIdentifier == finalAbility.abilityIdentifier))]; if (AbilityLocationList.Find(bt => bt.mapPosition.Location.ToVector2() == caster.position) != null) { // AbilityLocationList.Remove(AbilityLocationList.Find(bt => bt.mapPosition.Location.ToVector2() == caster.position)); } BasicTile randomDestinationTile; if (AbilityLocationList.Count != 0) { randomDestinationTile = AbilityLocationList[GamePlayUtility.Randomize(0, AbilityLocationList.Count)]; } else { randomDestinationTile = GameProcessor.loadedMap.possibleTiles(CombatProcessor.zone.returnBoundingZone()).Find(t => t.mapPosition == caster.spriteGameSize); } return(new KeyValuePair <BasicTile, BasicAbility>(randomDestinationTile, finalAbility)); }
internal static LUA.LuaAbilityInfo abiToLuaAbilityInfo(TBAGW.BasicAbility ba, LuaCharacterInfo caster, LuaCharacterInfo target, CallType ct = CallType.Attack) { LuaAbilityInfo lai = new LuaAbilityInfo(); lai.abiType = ba.abilityType.ToString(); lai.abiCastType = ba.abilityFightStyle.ToString(); lai.bIsAttack = ba.abilityType == (int)BasicAbility.ABILITY_TYPE.ATTACK; lai.minDmg = ba.baseDamage; lai.minDmg = (int)(lai.minDmg * target.parent.combatInfo.baseVSModifier(ba)); lai.maxDmg = (int)(lai.minDmg * 1.5f); lai.abiName = ba.abilityName; lai.target = target; lai.caster = caster; lai.target = target; lai.parent = ba; lai.hitChance = ba.ReturnAbilityHitChanceNum(caster.parent); lai.critChance = ba.ReturnAbilityCritChanceNum(caster.parent); if (caster != null) { caster.parent.combatInfo.CheckAffinity(target.parent); } if (target != null) { target.parent.combatInfo.CheckAffinity(target.parent); } if (target.parent.combatInfo.Absorbs(ba.affinity)) { lai.bAbsorbs = true; } if (BattleGUI.bIsRunning) { var surroundInfo = BattleGUI.GetSurroundInfo(); lai.surrAliesCaster = surroundInfo.gbcAllies; lai.surrEnemiesCaster = surroundInfo.gbcEnemies; lai.surrAliesTarget = surroundInfo.rbcAllies; lai.surrEnemiesTarget = surroundInfo.rbcEnemies; lai.critChance += surroundInfo.critChance; lai.hitChance += surroundInfo.hitChance; } switch (ct) { case CallType.Attack: break; case CallType.Area: lai.bCalledForArea = true; break; default: break; } return(lai); }
public void AddAbility(BasicAbility ba) { classAbilities.Add(ba); classAbilityInfos.Add(new ClassAbilityInfo(ba)); // classAbilitiesIDs.Add(ba.abilityIdentifier); }
private void LastDitchEffortAttack() { BasicAbility testAbility = currentEnemy.character.CCC.AIDefaultAttack.Clone(); testAbility.abilityCooldownTimer = 0; if (currentEnemy.character.AbilityList().Find(abi => abi.abilityIdentifier == testAbility.abilityIdentifier) == null) { currentEnemy.character.CCC.equippedClass.classAbilities.Add(testAbility); } List <BasicAbility> possibleAbilities = new List <BasicAbility>(); foreach (var ability in currentEnemy.character.AbilityList()) { if (ability.IsAbilityAvailable(currentEnemy.character.trueSTATChart())) { possibleAbilities.Add(ability); } } foreach (var item in possibleAbilities) { if (GamePlayUtility.randomChance() < item.castChance) { testAbility = item; break; } } if (testAbility.IsAbilityAvailable(currentEnemy.character.trueSTATChart())) { List <BaseCharacter> allTargetableCharactersInRange = new List <BaseCharacter>(); if (testAbility.abilityType == (int)BasicAbility.ABILITY_TYPE.ATTACK) { foreach (var item in currentEnemy.parentTS.targetGroups) { foreach (var character in item.charactersInGroup) { if (testAbility.abilityCanHitTargetInRange(currentEnemy.character, character)) { allTargetableCharactersInRange.Add(character); } } } if (allTargetableCharactersInRange.Count > 0) { // BattleGUI.AIStart(currentEnemy.character, allTargetableCharactersInRange[GamePlayUtility.Randomize(0, allTargetableCharactersInRange.Count)], currentEnemy.character.AbilityList().IndexOf(testAbility)); GameProcessor.StartBattleSoon(currentEnemy.character, allTargetableCharactersInRange[GamePlayUtility.Randomize(0, allTargetableCharactersInRange.Count)], currentEnemy.character.AbilityList().IndexOf(testAbility)); } } else if (testAbility.abilityType == (int)BasicAbility.ABILITY_TYPE.SUPPORT) { foreach (var character in currentEnemy.parentTS.charactersInGroup) { if (character == currentEnemy.character) { } if (character != currentEnemy.character && testAbility.abilityCanHitTargetInRange(currentEnemy.character, character)) { allTargetableCharactersInRange.Add(character); } } if (allTargetableCharactersInRange.Count > 0) { //BattleGUI.AIStart(currentEnemy.character, allTargetableCharactersInRange[GamePlayUtility.Randomize(0, allTargetableCharactersInRange.Count)], currentEnemy.character.AbilityList().IndexOf(testAbility)); GameProcessor.StartBattleSoon(currentEnemy.character, allTargetableCharactersInRange[GamePlayUtility.Randomize(0, allTargetableCharactersInRange.Count)], currentEnemy.character.AbilityList().IndexOf(testAbility)); } } } if (!BattleGUI.bIsRunning) { currentEnemy.character.attackedAsAI = true; } }
public void ReloadFromDatabase(GameContentDataBase gcDB) { #region charClassList var classesToDelete = new List <int>(); charClassListIDs = charClassListIDs.Distinct().ToList(); foreach (var item in charClassListIDs) { try { charClassList.Add(gcDB.gameClasses.Find(cl => cl.classIdentifier == item).Clone()); } catch (Exception) { } } //Removes all abilityIDs of abilities that don't exist anymore. charClassListIDs.RemoveAll(id => charClassList.Find(cl => cl.classIdentifier == id) == default(BaseClass)); #endregion #region charSeparateAbilities var abilitiesToDelete = new List <int>(); charSeparateAbilityIDs = charSeparateAbilityIDs.Distinct().ToList(); foreach (var item in charSeparateAbilityIDs) { try { charSeparateAbilities.Add(gcDB.gameAbilities.Find(abi => abi.abilityIdentifier == item).Clone()); } catch (Exception) { } } //Removes all abilityIDs of abilities that don't exist anymore. charSeparateAbilityIDs.RemoveAll(id => charSeparateAbilities.Find(ca => ca.abilityIdentifier == id) == default(BasicAbility)); #endregion try { equippedClass = gcDB.gameClasses.Find(gc => gc.classIdentifier == equippedClassIdentifier).Clone(); } catch (Exception) { equippedClass = new BaseClass(true); } try { var temp = gcDB.gameAbilities.Find(abi => abi.abilityIdentifier == defaultAbilityID); if (temp == null) { temp = new BasicAbility(); } AIDefaultAttack = temp.Clone(); } catch (Exception e) { } try { abiEquipList.Reload(this); } catch (Exception e) { } try { //classExp.Initialize(this); } catch (Exception e) { Console.WriteLine("Error initializing class EXP"); if (Game1.bIsDebug) { throw e; } } ReloadTalents(); }
public void AddAbility(BasicAbility ba) { ba.abilityIdentifier = abilityID; gameAbilities.Add(ba); abilityID++; }
public ClassAbilityInfo(BasicAbility ba) { abilityID = ba.abilityIdentifier; parent = ba; }