コード例 #1
0
        public static List <PlayerActionShortcut> FromWeapon(CarriedWeapon carriedWeapon, ItemEffect weaponEffect, Character player)
        {
            List <PlayerActionShortcut> results = new List <PlayerActionShortcut>();
            //Weapon weapon = AllWeapons.Get(weaponEffect.name);
            Weapon weapon = AllWeapons.Get(carriedWeapon.Weapon.Name);
            PlayerActionShortcutDto dto = new PlayerActionShortcutDto();

            if (!string.IsNullOrWhiteSpace(carriedWeapon.Name))
            {
                dto.name = carriedWeapon.Name;
            }
            else
            {
                dto.name = weapon.Name;
            }

            //dto.effectAvailableWhen = weaponEffect.effectAvailableWhen;

            dto.player = player.name;
            SetDtoFromEffect(dto, weaponEffect);
            dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.Attack);

            SetWeaponHitTime(dto, weapon);
            dto.plusModifier = carriedWeapon.HitDamageBonus.ToString();
            AddWeaponShortcuts(dto, results, weapon, player);
            foreach (PlayerActionShortcut playerActionShortcut in results)
            {
                playerActionShortcut.CarriedWeapon = carriedWeapon;
                playerActionShortcut.PlusModifier  = carriedWeapon.HitDamageBonus;
                playerActionShortcut.UsesMagic     = carriedWeapon.HitDamageBonus > 0;
            }

            AddItemEffect(results, weaponEffect);
            return(results);
        }
コード例 #2
0
        public static List <PlayerActionShortcut> From(PlayerActionShortcutDto shortcutDto)
        {
            List <PlayerActionShortcut> results = new List <PlayerActionShortcut>();
            string cleanName = DndUtils.GetCleanItemName(shortcutDto.name);
            Weapon weapon    = AllWeapons.Get(cleanName);

            if (weapon == null && cleanName.IndexOf(" of ") > 0)
            {
                // Try again with the weapon...
                cleanName = cleanName.EverythingBefore(" of ");
                weapon    = AllWeapons.Get(cleanName);
            }
            Character player = AllPlayers.GetFromId(PlayerID.FromName(shortcutDto.player));

            if (weapon != null)
            {
                AddWeaponShortcuts(shortcutDto, results, weapon, player);
            }
            else
            {
                List <Spell> spells = AllSpells.GetAll(cleanName, player);
                if (spells != null && spells.Count > 0)
                {
                    AddSpellShortcuts(shortcutDto, results, player, spells);
                }
                else                 // Not a weapon or a spell.
                {
                    PlayerActionShortcut shortcut = FromAction(shortcutDto);
                    results.Add(shortcut);
                    shortcut.AddEffect(shortcutDto, "", player);
                }
            }

            return(results);
        }
コード例 #3
0
 public static void Invalidate()
 {
     AllActionShortcuts.Invalidate();
     AllDieRollEffects.Invalidate();
     AllFeatures.Invalidate();
     AllFunctions.Invalidate();
     AllPlayers.Invalidate();
     AllProperties.Invalidate();
     AllSpellEffects.Invalidate();
     AllSpells.Invalidate();
     AllTables.Invalidate();
     AllTrailingEffects.Invalidate();
     AllWeaponEffects.Invalidate();
     AllWeapons.Invalidate();
 }