예제 #1
0
        private static string GetAdvType(Advantages item)
        {
            var typelist = new List <string>();

            if (item.isPhysical != null && (bool)item.isPhysical)
            {
                typelist.Add("Physical");
            }
            if (item.isMental != null && (bool)item.isMental)
            {
                typelist.Add("Mental");
            }
            if (item.isMundane != null && (bool)item.isMundane)
            {
                typelist.Add("Mundane");
            }
            if (item.isExotic != null && (bool)item.isExotic)
            {
                typelist.Add("Exotic");
            }
            if (item.isSocial != null && (bool)item.isSocial)
            {
                typelist.Add("Social");
            }
            if (item.isSuperNatural != null && (bool)item.isSuperNatural)
            {
                typelist.Add("Super-Natural");
            }
            var type = string.Join(",", typelist);

            return(type);
        }
        public IActionResult Create(Advantages manageClient)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (manageClient.Id == 0)
                    {
                        terms.Insert(manageClient);
                        return(Json("1"));
                    }

                    else
                    {
                        terms.Update(manageClient);
                        return(Json("1"));
                    }
                }
            }
            catch (Exception e)
            {
                String S1 = e.ToString();
            }
            return(View(manageClient));
        }
예제 #3
0
        public double ParseEffectiveness(List <BasicType> def)
        {
            var effect = 1.0;

            var defstr = $"{def[0].Type}";

            if (def.Count > 1)
            {
                defstr += $"/{def[1].Type}";
            }
            System.Console.WriteLine($"{Type} vs. {defstr}");
            System.Console.WriteLine($"{this.GetType().ToString()}");

            foreach (BasicType ty in def)
            {
                foreach (var adv in Advantages.Where(adv => ty.GetType() == adv.GetType()))
                {
                    System.Console.WriteLine($"{Type} is advantagous against {ty.Type}");
                    effect *= 2.0;
                }

                foreach (var dis in Disadvantages.Where(dis => ty.GetType() == dis.GetType()))
                {
                    System.Console.WriteLine($"{Type} is disadvantagous against {ty.Type}");
                    effect *= 0.5;
                }
            }

            return(effect);
        }
        public IActionResult DeleteConfirmed(Advantages manage)
        {
            var id = manage.Id;

            terms.Delete(id);
            //return RedirectToAction(nameof(Index));
            return(Json("1"));
        }
예제 #5
0
 private string GetRequirements(Advantages advitem)
 {
     foreach (var item in _reqList.Where(item => item.SourceType == "Advantage").Where(item => item.SourceItemID == advitem.Id))
     {
         return(item.TargetName);
     }
     return("");
 }
예제 #6
0
 private VampireSheet(Guid id, Header header, Attributes attributes, Abilities abilities, Advantages advantages, Status status)
     : base(id)
 {
     Header     = header;
     Attributes = attributes;
     Abilities  = abilities;
     Advantages = advantages;
     Status     = status;
 }
예제 #7
0
 public void InitControl(Advantages loadedAdvantage)
 {
     AdvantageId          = loadedAdvantage.Id;
     LblAdvLabel.Content  = loadedAdvantage.Name;
     TbDiscription.Text   = loadedAdvantage.Discription;
     TbDiscription.Text  += "\n\nLimitation:";
     TbDiscription.Text  += "\n" + loadedAdvantage.Limitation;
     LblAdvPoints.Content = loadedAdvantage.PointCost;
 }
예제 #8
0
 public void Init()
 {
     st            = 10;
     dx            = 10;
     iq            = 10;
     ht            = 10;
     attackDelay   = 2;
     advantages    = new Advantages(this);
     disadvantages = new Disadvantages(this);
 }
        public IActionResult Create(int id = 0)
        {
            Advantages model = new Advantages();

            if (id > 0)
            {
                model = terms.GetById(id);
            }

            return(View(@"~/Areas/Admin/Views/Advantages/Create.cshtml", model));
        }
 public ActionResult Post([FromBody] Advantages advantages)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest());
         }
         _advantagesService.Add(advantages);
         return(Ok());
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
예제 #11
0
 private void PopulateAdvantageSideBar(Advantages item)
 {
     TbAdvType.Text          = GetAdvType(item);
     TbAdvReq.Text           = GetRequirements(item);
     TbAdvName.Text          = item.Name;
     TxtbAdvDiscription.Text = item.Discription;
     TbAdvPointCost.Text     = item.PointCost.ToString();
     if (item.hasLevels != null && (bool)item.hasLevels)
     {
         LbladvLevel.Visibility = Visibility.Visible;
     }
     else
     {
         LbladvLevel.Visibility = Visibility.Hidden;
     }
 }
 public ActionResult <Advantages> Get(int id)
 {
     try
     {
         Advantages advantages = _advantagesService.GetWithId(id);
         if (advantages == null)
         {
             return(StatusCode(StatusCodes.Status404NotFound));
         }
         return(Ok(advantages));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
        public ActionResult Put(int id, [FromBody] Advantages advantages)
        {
            try
            {
                Advantages dbAdvatages = _advantagesService.GetWithId(id);
                if (dbAdvatages == null)
                {
                    return(BadRequest());
                }

                dbAdvatages.Icon        = advantages.Icon;
                dbAdvatages.Title       = advantages.Title;
                dbAdvatages.Description = advantages.Description;

                _advantagesService.Update(dbAdvatages);
                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }
예제 #14
0
        private void btAddAdvantage_Click(object sender, RoutedEventArgs e)
        {
            var findcontext = new Db1Entities();
            var foundstat   = (from c in findcontext.Advantages where c.Name == TbName.Text select c).FirstOrDefault();

            findcontext.Dispose();
            if (foundstat == null)
            {
                if (TbName.Text == "")
                {
                    MessageBox.Show("Please input a Name for the Advantage!");
                }
                else
                {
                    using (var newcontext = new Db1Entities())
                    {
                        var adv = new Advantages
                        {
                            isEnabled        = CbisEnabled.IsChecked != null && (bool)CbisEnabled.IsChecked,
                            isPhysical       = CbisPhysical.IsChecked != null && (bool)CbisPhysical.IsChecked,
                            isSocial         = CbisSocial.IsChecked != null && (bool)CbisSocial.IsChecked,
                            isSuperNatural   = CbisSuperNatural.IsChecked != null && (bool)CbisSuperNatural.IsChecked,
                            isExotic         = CbisExotic.IsChecked != null && (bool)CbisExotic.IsChecked,
                            isMundane        = CbisMundane.IsChecked != null && (bool)CbisMundane.IsChecked,
                            isMental         = CbisMental.IsChecked != null && (bool)CbisMental.IsChecked,
                            Limitation       = TbLimitation.Text,
                            Discription      = TbDiscription.Text,
                            PointCost        = Convert.ToInt32(TbPointCost.Text),
                            hasLevels        = CbhasLevels.IsChecked != null && (bool)CbhasLevels.IsChecked,
                            Name             = TbName.Text,
                            isCreationLocked = CbisCreationLocked.IsChecked != null && (bool)CbisCreationLocked.IsChecked,
                            Reference        = TbReference.Text
                        };
                        newcontext.Advantages.Add(adv);
                        newcontext.SaveChanges();
                        foreach (Modifier item in LbModifier.Items)
                        {
                            UsedModifier usedmod;
                            _dictMod.TryGetValue(item, out usedmod);
                            var firstOrDefault = (from c in newcontext.Advantages where c.Name == adv.Name select c).FirstOrDefault();
                            if (firstOrDefault != null)
                            {
                                if (usedmod != null)
                                {
                                    usedmod.ForeignId = firstOrDefault.Id;
                                }
                            }
                            newcontext.UsedModifier.Add(usedmod);
                            newcontext.SaveChanges();
                        }
                    }
                    MessageBox.Show("'" + TbName.Text + "' added to the Database");
                    TbName.Text = "";
                }
            }
            else
            {
                MessageBox.Show("That Advantage allready exists in the Database!");
            }
            LoadStackPanelContent();
            ClearControls();
        }
예제 #15
0
 public Card(Suit suit, Advantages advantages)
 {
     this.suit       = suit;
     this.advantages = advantages;
 }
예제 #16
0
 private void PopulateAdvantageSideBar( Advantages item )
 {
     TbAdvType.Text = GetAdvType(item);
     TbAdvReq.Text = GetRequirements(item);
     TbAdvName.Text = item.Name;
     TxtbAdvDiscription.Text = item.Discription;
     TbAdvPointCost.Text = item.PointCost.ToString();
     if (item.hasLevels != null && (bool) item.hasLevels)
     {
         LbladvLevel.Visibility = Visibility.Visible;
     }
     else
     {
         LbladvLevel.Visibility = Visibility.Hidden;
     }
 }
예제 #17
0
        // Constructor
        public PlayerViewModel(IBasePoints basePoints, IPlayerStat playerStat)
        {
            this.BasePoints = basePoints;
            this.PlayerStat = playerStat;

            this.Skills        = new ObservableCollection <IActiveSkill>();
            this.Advantages    = new ObservableCollection <IActiveAdvantage>();
            this.Disadvantages = new ObservableCollection <IActiveDisadvantage>();

            AddAttributeCommand = new DelegateCommand(PlayerStat.AddAttribute, null);
            SubAttributeCommand = new DelegateCommand(PlayerStat.SubAttribute, null);

            Scope = IoCContainer.Container.BeginLifetimeScope();

            AddSkillCommand = new DelegateCommand(
                x => {
                Skills.Add(Scope.Resolve <IActiveSkill>());
                AddSkillCommand.OnCanExecuteChanged();
            },
                x => AddSkillCanExecute()
                );
            RemoveSkillCommand = new DelegateCommand(
                x => {
                var SelectedItem       = Scope.Resolve <ISelectedItem>();
                IActiveSkill z         = Skills.First(p => p.Skill.Name == SelectedItem.SelectedSkillRemove.Skill.Name);
                BasePoints.UsedPoints -= z.Cost;
                RemoveSkillCommand.OnCanExecuteChanged();
                Skills.Remove(SelectedItem.SelectedSkillRemove);
            },
                x => Scope.Resolve <ISelectedItem>().SelectedSkillRemove != null);

            AddAdvantageCommand = new DelegateCommand(
                x => {
                IActiveAdvantage z = Scope.Resolve <IActiveAdvantage>();
                if (z.Advantage.PtPerLvl > BasePoints.UnspentPoints)
                {
                    return;
                }
                Advantages.Add(z);
                BasePoints.UsedPoints += z.Advantage.PtPerLvl;
                AddAdvantageCommand.OnCanExecuteChanged();
            },
                x => AddAdvantageCanExecute()
                );
            RemoveAdvantageCommand = new DelegateCommand(
                x => {
                var SelectedItem       = Scope.Resolve <ISelectedItem>();
                IActiveAdvantage z     = Advantages.First(p => p.Advantage.Name == SelectedItem.SelectedAdvantageRemove.Advantage.Name);
                BasePoints.UsedPoints -= z.Cost;
                RemoveAdvantageCommand.OnCanExecuteChanged();
                Advantages.Remove(SelectedItem.SelectedAdvantageRemove);
            },
                x => Scope.Resolve <ISelectedItem>().SelectedAdvantageRemove != null
                );

            AddDisadvantageCommand = new DelegateCommand(
                x => {
                IActiveDisadvantage z = Scope.Resolve <IActiveDisadvantage>();

                if ((z.Disadvantage.PtCost + BasePoints.UsedDisadvantagePoints) < BasePoints.MaxDisadvantagePoints)
                {
                    return;
                }

                Disadvantages.Add(z);
                BasePoints.UsedDisadvantagePoints += z.Disadvantage.PtCost;
                AddDisadvantageCommand.OnCanExecuteChanged();
            },
                x => AddDisadvantageCanExecute()
                );
            RemoveDisadvantageCommand = new DelegateCommand(
                x => {
                var SelectedItem                   = Scope.Resolve <ISelectedItem>();
                IActiveDisadvantage z              = Disadvantages.First(p => p.Disadvantage.Name == SelectedItem.SelectedDisadvantageRemove.Disadvantage.Name);
                BasePoints.UsedDisadvantagePoints -= z.Cost;
                RemoveDisadvantageCommand.OnCanExecuteChanged();
                Disadvantages.Remove(SelectedItem.SelectedDisadvantageRemove);
            },
                x => Scope.Resolve <ISelectedItem>().SelectedDisadvantageRemove != null
                );
        }
예제 #18
0
 public static Result <VampireSheet, VampireSheetError> New(Guid id, Header header, Attributes attributes, Abilities abilities, Advantages advantages, Status status)
 {
     return(new VampireSheet(id, header, attributes, abilities, advantages, status));
 }
예제 #19
0
 private void btAddAdvantage_Click( object sender, RoutedEventArgs e )
 {
     var findcontext = new Db1Entities();
     var foundstat = ( from c in findcontext.Advantages where c.Name == TbName.Text select c ).FirstOrDefault();
     findcontext.Dispose();
     if (foundstat == null)
     {
         if (TbName.Text == "")
         {
             MessageBox.Show("Please input a Name for the Advantage!");
         }
         else
         {
             using (var newcontext = new Db1Entities())
             {
                 var adv = new Advantages
                 {
                     isEnabled = CbisEnabled.IsChecked != null && (bool) CbisEnabled.IsChecked,
                     isPhysical = CbisPhysical.IsChecked != null && (bool) CbisPhysical.IsChecked,
                     isSocial = CbisSocial.IsChecked != null && (bool) CbisSocial.IsChecked,
                     isSuperNatural = CbisSuperNatural.IsChecked != null && (bool) CbisSuperNatural.IsChecked,
                     isExotic = CbisExotic.IsChecked != null && (bool) CbisExotic.IsChecked,
                     isMundane = CbisMundane.IsChecked != null && (bool) CbisMundane.IsChecked,
                     isMental = CbisMental.IsChecked != null && (bool) CbisMental.IsChecked,
                     Limitation = TbLimitation.Text,
                     Discription = TbDiscription.Text,
                     PointCost = Convert.ToInt32(TbPointCost.Text),
                     hasLevels = CbhasLevels.IsChecked != null && (bool) CbhasLevels.IsChecked,
                     Name = TbName.Text,
                     isCreationLocked = CbisCreationLocked.IsChecked != null && (bool) CbisCreationLocked.IsChecked,
                     Reference = TbReference.Text
                 };
                 newcontext.Advantages.Add(adv);
                 newcontext.SaveChanges();
                 foreach (Modifier item in LbModifier.Items)
                 {
                     UsedModifier usedmod;
                     _dictMod.TryGetValue(item, out usedmod);
                     var firstOrDefault = ( from c in newcontext.Advantages where c.Name == adv.Name select c ).FirstOrDefault();
                     if (firstOrDefault != null)
                     {
                         if (usedmod != null)
                         {
                             usedmod.ForeignId = firstOrDefault.Id;
                         }
                     }
                     newcontext.UsedModifier.Add(usedmod);
                     newcontext.SaveChanges();
                 }
             }
             MessageBox.Show("'" + TbName.Text + "' added to the Database");
             TbName.Text = "";
         }
     }
     else
     {
         MessageBox.Show("That Advantage allready exists in the Database!");
     }
     LoadStackPanelContent();
     ClearControls();
 }
 public void Update(Advantages data)
 {
     _advantagesDal.Update(data);
 }
 public void Add(Advantages data)
 {
     _advantagesDal.Add(data);
 }
예제 #22
0
 private static string GetAdvType( Advantages item )
 {
     var typelist = new List<string>();
     if (item.isPhysical != null && (bool) item.isPhysical)
     {
         typelist.Add("Physical");
     }
     if (item.isMental != null && (bool) item.isMental)
     {
         typelist.Add("Mental");
     }
     if (item.isMundane != null && (bool) item.isMundane)
     {
         typelist.Add("Mundane");
     }
     if (item.isExotic != null && (bool) item.isExotic)
     {
         typelist.Add("Exotic");
     }
     if (item.isSocial != null && (bool) item.isSocial)
     {
         typelist.Add("Social");
     }
     if (item.isSuperNatural != null && (bool) item.isSuperNatural)
     {
         typelist.Add("Super-Natural");
     }
     var type = string.Join(",", typelist);
     return type;
 }
 public void AddAdvantage(Advantage advantage)
 {
     Advantages.Add(advantage);
     advantage.Activate(this);
 }
예제 #24
0
 private string GetRequirements( Advantages advitem )
 {
     foreach (var item in _reqList.Where(item => item.SourceType == "Advantage").Where(item => item.SourceItemID == advitem.Id))
     {
         return item.TargetName;
     }
     return "";
 }
 public void RemoveAdvantage(Advantage advantage)
 {
     Advantages.Remove(advantage);
     advantage.Deactivate(this);
 }
예제 #26
0
 public bool AddAdvantageCanExecute()
 {
     return(!Advantages.Any(p => p.Advantage.Name == Scope.Resolve <ISelectedItem>().SelectedAdvantage?.Name));
 }