public bool CheckMagicEffect(TargetCharacter character, MagicEffectType effectType) { foreach (MagicEffect effect in activeMagicEffects) { if ((effect.TargetCharacter == character) && (effect.Type == effectType)) { return(true); } } return(false); }
public void Clear(TargetCharacter character, MagicEffectType type) { for (int i = 0; i < activeMagicEffects.Count; i++) { if ((activeMagicEffects[i].TargetCharacter == character) && (activeMagicEffects[i].Type == type)) { activeMagicEffects.RemoveAt(i); i = 0; } } }
public MagicEffect(TargetCharacter character, MagicEffectType type, float value, int currentTurn, int lTime, bool infinit) { startTurn = currentTurn; endTurn = startTurn + lTime; this.infinit = infinit; targetCharacter = character; this.type = type; switch (type) { case MagicEffectType.Armor: this.value = value; ChangeArmor((int)value); break; case MagicEffectType.Fire: this.value = value / 10; break; case MagicEffectType.Healing: this.value = value; break; case MagicEffectType.IncreaseMaxHealthPoint: this.value = value; ChangeMaxHealthPoint(value); break; case MagicEffectType.Ice: this.value = value * 3; ChangeAgility((int)this.value); break; case MagicEffectType.Water: this.value = value * 2; ChangeAgility((int)this.value); break; } }
public static StatusObject CreateStringPermutationBatchFiles(string MaxWordLength, string DataSourceName) { StatusObject SO = new StatusObject(); try { string TargetString = ""; for (int LargeAlphabet = 65; LargeAlphabet <= 90; LargeAlphabet++) { TargetString += (char)LargeAlphabet; } for (int smallAlphabet = 97; smallAlphabet <= 122; smallAlphabet++) { TargetString += (char)smallAlphabet; } for (int Numeric = 48; Numeric <= 57; Numeric++) { TargetString += (char)Numeric; } for (int Symbol = 32; Symbol <= 47; Symbol++) { TargetString += (char)Symbol; } for (int Symbol = 58; Symbol <= 64; Symbol++) { TargetString += (char)Symbol; } for (int Symbol = 91; Symbol <= 96; Symbol++) { TargetString += (char)Symbol; } for (int Symbol = 123; Symbol <= 126; Symbol++) { TargetString += (char)Symbol; } Directory.CreateDirectory(RainbowTableBatchFilePath); foreach (char TargetCharacter in TargetString) { for (int i = 1; i <= Convert.ToInt32(MaxWordLength); i++) { //RAINBOW_97_10 Console.WriteLine("RAINBOW_{0}_{1}.bat", (int)TargetCharacter, i); string ReplacementCharacter = null; bool requiresEscape = false; if (TargetCharacter == ' ') { ReplacementCharacter = "space"; requiresEscape = true; } else if (JARVISUniversalDefinitions.BatchFileEscapeCharacters.ContainsKey(TargetCharacter)) { ReplacementCharacter = JARVISUniversalDefinitions.BatchFileEscapeCharacters[TargetCharacter]; requiresEscape = true; } StreamWriter BatchFile = new StreamWriter(String.Format(@"{0}\RAINBOW_{1}_{2}.bat", RainbowTableBatchFilePath, (int)TargetCharacter, i)); string batchInstruction = String.Format( "{0} wordlist populatetables {1} {2} {3}", System.Reflection.Assembly.GetEntryAssembly().Location, DataSourceName, (requiresEscape) ? ReplacementCharacter : TargetCharacter.ToString(), i); BatchFile.WriteLine(batchInstruction); BatchFile.Close(); } } } catch (Exception e) { SO = new StatusObject(StatusCode.FAILURE, "CreateStringPermutationBatchFiles_ERROR", e.Message, e.ToString()); } return(SO); }
public void TakeDamage(TargetCharacter character, float damageFromAnotherChar, DamageType type) { missAttack = false; switch (type) { case DamageType.Physical: if (armor > 0) { damageFromAnotherChar -= damageFromAnotherChar / 100 * armor; } if (armor > 100) { damageFromAnotherChar = 0; } if (mainBattleScript.MagicEffectManager.CheckMagicEffect(currentCharacter, MagicEffectType.Ice)) { damageFromAnotherChar *= 1.5f; } //Check miss if (RandomEvClass.RandomEv(new float[2] { agility, 100 - agility }) == 0) { lastDamage = 0; missAttack = true; return; } animator.SetBool("Hit", true); break; case DamageType.Lightning: if (armor > 0) { damageFromAnotherChar += damageFromAnotherChar * armor / 100; } if (mainBattleScript.MagicEffectManager.CheckMagicEffect(currentCharacter, MagicEffectType.Ice)) { damageFromAnotherChar /= 1.25f; } if (mainBattleScript.MagicEffectManager.CheckMagicEffect(currentCharacter, MagicEffectType.Water)) { damageFromAnotherChar *= 2; } animator.SetBool("LightningHit", true); break; case DamageType.Fire: mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Water); /// if (mainBattleScript.MagicEffectManager.CheckMagicEffect(currentCharacter, MagicEffectType.Ice)) { mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Ice); mainBattleScript.MagicEffectManager.AddMagicEffect(currentCharacter, MagicEffectType.Water, agility, 4, false); } /// mainBattleScript.MagicEffectManager.AddMagicEffect(currentCharacter, MagicEffectType.Fire, damageFromAnotherChar, 4, false); /// animator.SetBool("FireHit", true); break; case DamageType.Ice: mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Fire); mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Healing); if (mainBattleScript.MagicEffectManager.CheckMagicEffect(currentCharacter, MagicEffectType.Water)) { damageFromAnotherChar *= 1.25f; } mainBattleScript.MagicEffectManager.AddMagicEffect(currentCharacter, MagicEffectType.Ice, agility, 4, false); mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Water); /// animator.SetBool("IceHit", true); break; case DamageType.Water: mainBattleScript.MagicEffectManager.Clear(currentCharacter, MagicEffectType.Fire); damageFromAnotherChar /= 10; mainBattleScript.MagicEffectManager.AddMagicEffect(currentCharacter, MagicEffectType.Water, agility, 4, false); /// animator.SetBool("WaterHit", true); break; } healthPoint -= damageFromAnotherChar; lastDamage = damageFromAnotherChar; }
public void AddMagicEffect(TargetCharacter character, MagicEffectType type, float value, int lTime, bool infinit) { activeMagicEffects.Add(new MagicEffect(character, type, value, mainBScript.TurnCount, lTime, infinit)); }