public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); defeatInfo = new DefeatInfo(); mob = new Mock <IMobileObject>(); random = new Mock <IRandom>(); defeatInfo.CurrentEnchantmentPoints = 1000; defeatInfo.MobStat = Stat.Constitution; mob.Setup(e => e.GetStatEffective(Stat.Constitution)).Returns(800); random.Setup(e => e.Next(1000)).Returns(500); random.Setup(e => e.Next(800)).Returns(400); GlobalReference.GlobalValues.Random = random.Object; }
protected override void AdditionalEffect(IMobileObject performer, IMobileObject target) { //notify the target what is happening since it doesn't happen earlier; ITranslationMessage message = new TranslationMessage(GlobalReference.GlobalValues.StringManipulator.UpdateTargetPerformer(performer.SentenceDescription, target.SentenceDescription, TargetNotificationSuccess.Message)); GlobalReference.GlobalValues.Notify.Mob(target, message); IEnchantment enchantment = new HeartbeatBigTickEnchantment(); IEffect effect = new Blindness(); IEffectParameter effectParameter = new EffectParameter(); IDefeatInfo defeatInfo = new DefeatInfo(); enchantment.ActivationPercent = 100; enchantment.Effect = effect; enchantment.Parameter = effectParameter; enchantment.EnchantmentEndingDateTime = new DateTime(9999, 1, 1); enchantment.DefeatInfo = defeatInfo; defeatInfo.CurrentEnchantmentPoints = performer.StrengthEffective; defeatInfo.MobStat = Stat.Constitution; target.Enchantments.Add(enchantment); }
protected override void AdditionalEffect(IMobileObject performer, IMobileObject target) { IEnchantment enchantment = new Magic.Enchantment.HeartbeatBigTickEnchantment(); IEffect effect = new Effect.Damage(); IEffectParameter effectParameter = new EffectParameter(); IDefeatInfo defeatInfo = new DefeatInfo(); enchantment.ActivationPercent = 100; enchantment.Effect = effect; enchantment.Parameter = effectParameter; enchantment.EnchantmentEndingDateTime = new DateTime(9999, 1, 1); enchantment.DefeatInfo = defeatInfo; defeatInfo.CurrentEnchantmentPoints = performer.ConstitutionEffective; defeatInfo.MobStat = Stat.Constitution; effectParameter.TargetMessage = new TranslationMessage("Poison burns your face."); effectParameter.Damage = new Objects.Damage.Damage(); effectParameter.Damage.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForSkillLevel(28); effectParameter.Damage.Type = DamageType.Poison; target.Enchantments.Add(enchantment); }
/// <summary> /// Handles the <see cref="Selector.SelectionChanged"/> event for the "Compare" <see /// cref="ListView"/> on the <see cref="TablesTab"/> page.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="SelectionChangedEventArgs"/> object containing event data.</param> /// <remarks> /// <b>OnCompareTableSelected</b> updates the "Defeat" and "Victory" text boxes and the /// "Faction" list view to reflect the selected ranking criterion.</remarks> private void OnCompareTableSelected(object sender, SelectionChangedEventArgs args) { args.Handled = true; // retrieve selected item, if any CompareListItem item = CompareTableList.SelectedItem as CompareListItem; // clear faction list FactionList.Items.Clear(); // clear thresholds if selection cleared if (item == null) { DefeatInfo.Clear(); VictoryInfo.Clear(); return; } // retrieve selected criterion string id = item.Item3 as String; var resource = item.Item3 as ResourceClass; if (resource != null) { id = resource.Id; } // show faction ranking CreateFactionRows(resource, id); string defeatText = "—"; // em dash string victoryText = "—"; // em dash if (resource != null) { // show global thresholds for resource conditions if (resource.Defeat != Int32.MinValue) { defeatText = resource.Format(resource.Defeat, false); } if (resource.Victory != Int32.MaxValue) { victoryText = resource.Format(resource.Victory, false); } } else { ConditionParameter parameter = ConditionParameter.Turns; switch (id) { case "sites": parameter = ConditionParameter.Sites; break; case "units": parameter = ConditionParameter.Units; break; case "unit-strength": parameter = ConditionParameter.UnitStrength; break; } // show common thresholds for specific conditions if (parameter != ConditionParameter.Turns) { defeatText = GetCommonThreshold(false, parameter); victoryText = GetCommonThreshold(true, parameter); } } // show or clear thresholds DefeatInfo.Text = defeatText; VictoryInfo.Text = victoryText; }