Ejemplo n.º 1
0
        static void LoadData()
        {
            weaponEffects = new List <ItemEffect>();
            List <ItemEffectDto> weaponEffectDtos = CsvToSheetsHelper.Get <ItemEffectDto>(Folders.InCoreData("DnD - WeaponEffects.csv"));

            foreach (ItemEffectDto itemEffect in weaponEffectDtos)
            {
                WeaponEffects.Add(ItemEffect.From(itemEffect));
            }
        }
Ejemplo n.º 2
0
        static void AddWeaponShortcutsFor(Character player, CarriedWeapon carriedWeapon)
        {
            List <PlayerActionShortcut> lastShortcuts = null;

            List <ItemEffect> weaponEffects = AllWeaponEffects.GetAll(carriedWeapon.Name).OrderBy(x => x.index).ToList();

            if (!weaponEffects.Any())
            {
                if (carriedWeapon.Weapon != null)
                {
                    weaponEffects = AllWeaponEffects.GetAll(carriedWeapon.Weapon.Name).OrderBy(x => x.index).ToList();
                }
            }
            ;
            if (weaponEffects.Count == 0)
            {
                lastShortcuts = PlayerActionShortcut.FromWeapon(carriedWeapon, null, player);
            }
            else
            {
                for (int i = 0; i < weaponEffects.Count; i++)
                {
                    ItemEffect itemEffect = weaponEffects[i];
                    if (i == 0)
                    {
                        lastShortcuts = PlayerActionShortcut.FromWeapon(carriedWeapon, itemEffect, player);
                    }
                    else
                    {
                        foreach (PlayerActionShortcut playerActionShortcut in lastShortcuts)
                        {
                            playerActionShortcut.Windups.Add(WindupDto.FromItemEffect(itemEffect, PlayerActionShortcut.WeaponWindupPrefix + playerActionShortcut.DisplayText));
                        }
                    }
                }
            }

            if (lastShortcuts != null)
            {
                AllShortcuts.AddRange(lastShortcuts);
            }
        }
Ejemplo n.º 3
0
 // We may be able to safely remove this.
 private static void SetDtoFromEffect(PlayerActionShortcutDto dto, ItemEffect itemEffect)
 {
     //if (itemEffect == null)
     //	return;
     //dto.brightness = itemEffect.brightness.ToString();
     //dto.degreesOffset = itemEffect.degreesOffset.ToString();
     //dto.dieRollEffects = itemEffect.dieRollEffects;
     //dto.effect = itemEffect.effect;
     //dto.endSound = itemEffect.endSound;
     //dto.flipHorizontal = MathUtils.BoolToStr(itemEffect.flipHorizontal);
     //dto.endSound = itemEffect.endSound;
     //dto.hue = itemEffect.hue;
     //dto.moveLeftRight = itemEffect.moveLeftRight.ToString();
     //dto.moveUpDown = itemEffect.moveUpDown.ToString();
     //dto.opacity = itemEffect.opacity.ToString();
     //dto.playToEndOnExpire = MathUtils.BoolToStr(itemEffect.playToEndOnExpire);
     //dto.rotation = itemEffect.rotation.ToString();
     //dto.saturation = itemEffect.saturation.ToString();
     //dto.scale = itemEffect.scale.ToString();
     //dto.startSound = itemEffect.startSound;
     //dto.trailingEffects = itemEffect.trailingEffects;
 }
Ejemplo n.º 4
0
        //public static WindupDto From(PlayerActionShortcutDto shortcutDto, Character player)
        //{
        //	if (string.IsNullOrEmpty(shortcutDto.effect))
        //		return null;
        //	if (shortcutDto.effect.StartsWith("//"))
        //		return null;
        //	WindupDto windupDto = new WindupDto();
        //	windupDto.Effect = shortcutDto.effect;
        //	if (!string.IsNullOrEmpty(shortcutDto.hue))
        //		if (shortcutDto.hue == "player")
        //			windupDto.Hue = player.hueShift;
        //		else if (int.TryParse(shortcutDto.hue, out int hue))
        //			windupDto.Hue = hue;
        //	windupDto.Brightness = MathUtils.GetInt(shortcutDto.brightness, 100);
        //	windupDto.Saturation = MathUtils.GetInt(shortcutDto.saturation, 100);
        //	windupDto.Scale = MathUtils.GetDouble(shortcutDto.scale, 1);
        //	windupDto.Opacity = MathUtils.GetDouble(shortcutDto.opacity, 1);
        //	windupDto.Rotation = MathUtils.GetInt(shortcutDto.rotation);
        //	windupDto.DegreesOffset = MathUtils.GetInt(shortcutDto.degreesOffset);
        //	windupDto.FlipHorizontal = MathUtils.IsChecked(shortcutDto.flipHorizontal);
        //	if (MathUtils.IsChecked(shortcutDto.fade))
        //		windupDto.Fade();
        //	if (MathUtils.IsChecked(shortcutDto.playToEndOnExpire))
        //		windupDto.PlayToEndOnExpire = true;

        //	int deltaX = MathUtils.GetInt(shortcutDto.moveLeftRight);
        //	int deltaY = MathUtils.GetInt(shortcutDto.moveUpDown);
        //	windupDto.Offset = new Vector(deltaX, deltaY);

        //	windupDto.StartSound = shortcutDto.startSound;
        //	windupDto.EndSound = shortcutDto.endSound;
        //	windupDto.Description = shortcutDto.description;
        //	return windupDto;
        //}

        public static WindupDto FromItemEffect(ItemEffect itemEffect, string effectName)
        {
            if (itemEffect == null)
            {
                return(null);
            }

            WindupDto result = new WindupDto();

            result.Effect = itemEffect.effect;

            result.Scale   = itemEffect.scale;
            result.Opacity = itemEffect.opacity;
            if (itemEffect.fade)
            {
                result.FadeIn  = 500;
                result.FadeOut = 900;
            }
            else
            {
                result.FadeIn  = itemEffect.FadeIn;
                result.FadeOut = itemEffect.FadeOut;
            }

            switch (itemEffect.kind)
            {
            case ItemEffectKind.None:
                result.Name = effectName;
                break;

            case ItemEffectKind.Windup:
                result.Name = "Windup." + effectName;
                break;

            case ItemEffectKind.Spell:
                result.Name = PlayerActionShortcut.SpellWindupPrefix + effectName;
                break;

            case ItemEffectKind.Strike:
                result.Name = "Strike." + effectName;
                break;

            case ItemEffectKind.Target:
                result.Name = "Target." + effectName;
                break;
            }
            result.Lifespan = itemEffect.Lifespan;

            result.HueStr              = itemEffect.hue;
            result.Hue                 = MathUtils.GetInt(itemEffect.hue);
            result.Saturation          = itemEffect.saturation;
            result.Brightness          = itemEffect.brightness;
            result.StartSound          = itemEffect.startSound;
            result.EndSound            = itemEffect.endSound;
            result.Rotation            = itemEffect.rotation;
            result.DegreesOffset       = (int)Math.Round(itemEffect.degreesOffset);
            result.Offset              = new Vector(itemEffect.moveLeftRight, itemEffect.moveUpDown);
            result.PlayToEndOnExpire   = itemEffect.playToEndOnExpire;
            result.FlipHorizontal      = itemEffect.flipHorizontal;
            result.EffectAvailableWhen = itemEffect.effectAvailableWhen;
            return(result);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public static List <PlayerActionShortcut> FromItemSpellEffect(string spellName, ItemEffect spellEffect, Character player)
        {
            List <PlayerActionShortcut> results = new List <PlayerActionShortcut>();

            List <Spell> spells = AllSpells.GetAll(spellName);

            foreach (Spell spell in spells)
            {
                PlayerActionShortcutDto dto = new PlayerActionShortcutDto();
                dto.name   = spell.Name;
                dto.player = player.name;

                //dto.effectAvailableWhen = weaponEffect.effectAvailableWhen;

                SetDtoFromEffect(dto, spellEffect);
                dto.type = GetDiceRollTypeStr(spell);
                SetSpellCastingTime(dto, spell);
                List <Spell> oneSpell = new List <Spell>();
                oneSpell.Add(spell);
                AddSpellShortcuts(dto, results, player, oneSpell);
            }

            AddItemEffect(results, spellEffect);

            return(results);
        }
Ejemplo n.º 7
0
        public static List <PlayerActionShortcut> FromItemSpellEffect(string spellName, ItemEffect spellEffect, Character player)
        {
            List <PlayerActionShortcut> results = new List <PlayerActionShortcut>();

            List <Spell> spells = AllSpells.GetAll(spellName);

            foreach (Spell spell in spells)
            {
                PlayerActionShortcutDto dto = new PlayerActionShortcutDto();
                dto.name   = spell.Name;
                dto.player = player.name;

                //dto.effectAvailableWhen = weaponEffect.effectAvailableWhen;

                SetDtoFromEffect(dto, spellEffect);
                if (spell.SpellType == SpellType.RangedSpell || spell.SpellType == SpellType.MeleeSpell)
                {
                    if (spell.Name == "Chaos Bolt")
                    {
                        dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.ChaosBolt);
                    }
                    else
                    {
                        dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.Attack);
                    }
                }
                else if (spell.SpellType == SpellType.SavingThrowSpell)
                {
                    dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.DamageOnly);
                }
                else if (spell.SpellType == SpellType.OtherSpell)
                {
                    dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.None);
                }
                else if (spell.SpellType == SpellType.HpCapacitySpell)
                {
                    dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.ExtraOnly);
                }
                else
                {
                    dto.type = DndUtils.DiceRollTypeToStr(DiceRollType.None);
                }

                SetSpellCastingTime(dto, spell);
                List <Spell> oneSpell = new List <Spell>();
                oneSpell.Add(spell);
                AddSpellShortcuts(dto, results, player, oneSpell);
            }

            AddItemEffect(results, spellEffect);

            return(results);
        }