public static void TryApply(this OnHitStatus onHitStatus, SavingThrow savingThrow, PlayableEntity applicant, PlayableEntity target) { if (onHitStatus.HasApplyCondition) { ICustomConsole console = DIContainer.GetImplementation <ICustomConsole>(); IFontColorProvider colorProvider = DIContainer.GetImplementation <IFontColorProvider>(); IFontWeightProvider fontWeightProvider = DIContainer.GetImplementation <IFontWeightProvider>(); // there is a saving throw to resist the status Characteristic charac = target.Characteristics.GetCharacteristic(onHitStatus.ApplySavingCharacteristic); console.AddEntry(target.DisplayName, fontWeightProvider.Bold); console.AddEntry(" tries to restist the "); console.AddEntry(onHitStatus.Header, fontWeightProvider.Bold); console.AddEntry(" status from "); console.AddEntry(applicant.DisplayName, fontWeightProvider.Bold); console.AddEntry(". "); console.AddEntry($"{savingThrow.Result}/{savingThrow.Difficulty}", fontWeightProvider.Bold); console.AddEntry(" ==> "); if (savingThrow.Result >= savingThrow.Difficulty) { //resist console.AddEntry("Success\r\n", fontWeightProvider.Bold); //applyStatus(false); } else { //fails console.AddEntry("Failure\r\n", fontWeightProvider.Bold); //applyStatus(); } } }
public static void ConfigureWpf() { // REGISTER // Console DIContainer.RegisterSingleton <ICustomConsole, WpfConsole>(); DIContainer.RegisterSingleton <IFontColorProvider, WpfFontColorProvider>(); DIContainer.RegisterSingleton <IFontWeightProvider, WpfFontWeightProvider>(); // CONFIGURE // WpfConsole ICustomConsole console = DIContainer.GetImplementation <ICustomConsole>(); console.DefaultFontColor = new WpfFontColor() { Brush = Application.Current.Resources["Light"] as SolidColorBrush }; // FontColorProvider IFontColorProvider colorProvider = DIContainer.GetImplementation <IFontColorProvider>(); colorProvider.SetDefault(new WpfFontColor() { Brush = Application.Current.Resources["Light"] as SolidColorBrush }); colorProvider.AddKey("Light", new WpfFontColor() { Brush = Application.Current.Resources["Light"] as SolidColorBrush }); colorProvider.AddKey("Acid", new WpfFontColor() { Brush = new SolidColorBrush(Colors.YellowGreen) }); colorProvider.AddKey("Cold", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Aqua) }); colorProvider.AddKey("Fire", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Red) }); colorProvider.AddKey("Lightning", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Yellow) }); colorProvider.AddKey("Necrotic", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Black) }); colorProvider.AddKey("Poison", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Green) }); colorProvider.AddKey("Psychic", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Purple) }); colorProvider.AddKey("Radiant", new WpfFontColor() { Brush = new SolidColorBrush(Colors.Orange) }); }