// FUNCTIONS // public void Apply(Creature user, Creature victim) { victim.DefendAgainstDmg(damageType, victimDamage); if (appliedEffect != null) { if (Program.RNG.Next(0, 100) < appliedEffect.Chance) { Effect effectInstance = appliedEffect.Copy(); effectInstance.User = user; Program.MsgConsole.WriteLine($"{user.Name} inflicted {victim.Name} with {effectInstance.Name}."); victim.Effects.Add(effectInstance.Copy()); } } }
// FUNCTIONS // public void Apply(Creature victim) { string victimText = $"{victim.Name}"; string userText = $"{user.Name}"; if (victimHPDamageType != DamageType.None) { int damageTaken = victim.DefendAgainstDmg(victimHPDamageType, victimResourceDamage[0]); victimText += $" recieved {damageTaken} {victimHPDamageType.ToString()} damage,"; } if (victimResourceDamage[1] > 0) { victim.ChangeResource(Resource.MP, -victimResourceDamage[1]); victimText += $" lost {victimResourceDamage[1]} magicka,"; } if (victimResourceDamage[2] > 0) { victim.ChangeResource(Resource.SP, -victimResourceDamage[2]); victimText += $" lost {victimResourceDamage[2]} stamina,"; } if (victimResourceHealing[0] > 0) { victim.ChangeResource(Resource.HP, victimResourceHealing[0]); victimText += $" had {victimResourceHealing[0]} health restored,"; } if (victimResourceHealing[1] > 0) { victim.ChangeResource(Resource.MP, victimResourceHealing[1]); victimText += $" had {victimResourceHealing[1]} magicka restored,"; } if (victimResourceHealing[2] > 0) { victim.ChangeResource(Resource.SP, victimResourceHealing[2]); victimText += $" had {victimResourceHealing[2]} stamina restored,"; } if (userResourceHealing[0] > 0) { user.ChangeResource(Resource.SP, userResourceHealing[0]); userText += $" recieved {userResourceHealing[0]} health,"; } if (userResourceHealing[1] > 0) { user.ChangeResource(Resource.SP, userResourceHealing[1]); userText += $" recieved {userResourceHealing[1]} magicka,"; } if (userResourceHealing[2] > 0) { user.ChangeResource(Resource.SP, userResourceHealing[2]); userText += $" recieved {userResourceHealing[2]} stamina,"; } if (!victimText.Equals($"{victim.Name}")) { victimText = victimText.Substring(0, victimText.LastIndexOf(',')); if (victimText.Contains(",")) { int commaIndex = victimText.LastIndexOf(','); victimText = victimText.Substring(0, commaIndex) + " and " + victimText.Substring(commaIndex + 2, victimText.Length - (commaIndex + 2)); } victimText += $" from {name}."; Program.MsgConsole.WriteLine(victimText); } if (!userText.Equals($"{user.Name}")) { userText = userText.Substring(0, userText.LastIndexOf(',')); if (userText.Contains(",")) { int commaIndex = userText.LastIndexOf(','); userText = userText.Substring(0, commaIndex) + " and " + userText.Substring(commaIndex + 2, userText.Length - (commaIndex + 2)); } userText += $" from {name}."; Program.MsgConsole.WriteLine(userText); } turns--; if (turns == 0) { victim.Effects.Remove(this); } }