コード例 #1
0
        public static ISkillUseStrategy Make(SkillTargetType targetType)
        {
            switch (targetType)
            {
            case SkillTargetType.None:
                return(new NoneSkillUseStrategy());

            case SkillTargetType.Unit:
                return(new UnitSkillUseStrategy());

            case SkillTargetType.AllyUnit:
                return(new AllyUnitSkillUseStrategy());

            case SkillTargetType.EnemyUnit:
                return(new EnemyUnitSkillUseStrategy());

            case SkillTargetType.Point:
                return(new PointSkillUseStrategy());

            case SkillTargetType.Unoccupied:
                return(new UnoccupiedSkillUseStrategy());

            case SkillTargetType.Corpse:
                return(new CorpseSkillUseStrategy());

            default:
                throw new ArgumentOutOfRangeException(nameof(targetType), targetType, null);
            }
        }
コード例 #2
0
        public static IEnumerable <CharacterBase> GetTarget(this SkillTargetType value, CharacterBase caster)
        {
            var targets = caster.Targets;
            IEnumerable <CharacterBase> target;

            switch (value)
            {
            case SkillTargetType.Enemy:
                target = new[] { targets.First() };
                break;

            case SkillTargetType.Enemies:
                target = caster.Targets;
                break;

            case SkillTargetType.Self:
                target = new[] { caster };
                break;

            case SkillTargetType.Ally:
                target = new[] { caster };
                break;

            default:
                target = new[] { targets.First() };
                break;
            }

            return(target);
        }
コード例 #3
0
ファイル: SkillData.cs プロジェクト: pedroaz/SevenWorlds
 public SkillData(SkillDescription description)
 {
     SkillId           = description.SkillId;
     TargetType        = description.TargetType;
     Description       = description.Description;
     DamageDescription = description.DamageDescription;
     BaseCD            = description.BaseCD;
 }
コード例 #4
0
        public List <SkillTarget> GetTargets(SkillTargetType type)
        {
            if (_targets.ContainsKey(type) == false)
            {
                return(new List <SkillTarget>());
            }

            return(_targets[type]);
        }
コード例 #5
0
ファイル: SkillSheet.cs プロジェクト: x86chi/lib9c
 public IValue Serialize() =>
 Bencodex.Types.Dictionary.Empty
 .Add("id", Id)
 .Add("elemental_type", ElementalType.ToString())
 .Add("skill_type", SkillType.ToString())
 .Add("skill_category", SkillCategory.ToString())
 .Add("skill_target_type", SkillTargetType.ToString())
 .Add("hit_count", HitCount)
 .Add("cooldown", Cooldown);
コード例 #6
0
ファイル: SkillHit.cs プロジェクト: midgithub/ProjectC
    static bool CheckTargetType(Character cha, Character target, SkillTargetType type)
    {
        switch (type)
        {
        case SkillTargetType.All:
            return(true);

        case SkillTargetType.Enemy:
        {
            if (CampSystem.IsEnemy(cha, target))
            {
                return(true);
            }
            break;
        }

        case SkillTargetType.Friend:
        {
            if (CampSystem.IsFriend(cha, target))
            {
                return(true);
            }
            break;
        }

        case SkillTargetType.FriendDead:
        {
            if (CampSystem.IsFriend(cha, target))
            {
                return(true);
            }
            break;
        }

        case SkillTargetType.Neutral:
        {
            if (!CampSystem.IsEnemy(cha, target) && !CampSystem.IsFriend(cha, target))
            {
                return(true);
            }
            break;
        }

        case SkillTargetType.Self:
        {
            if (cha == target)
            {
                return(true);
            }
            break;
        }
        }
        return(false);
    }
コード例 #7
0
 public SkillInfo(CharacterBase character, int effect, bool critical, SkillCategory skillCategory,
                  int waveTurn, ElementalType elementalType = ElementalType.Normal,
                  SkillTargetType targetType = SkillTargetType.Enemy, [CanBeNull] Model.Buff.Buff buff = null)
 {
     Target          = character;
     Effect          = effect;
     Critical        = critical;
     SkillCategory   = skillCategory;
     ElementalType   = elementalType;
     SkillTargetType = targetType;
     Buff            = buff;
     WaveTurn        = waveTurn;
 }
コード例 #8
0
    public SkillTargetType GetMonsterSkillTargetType(string monsterName, int skill)
    {
        SkillTargetType data  = SkillTargetType.None;
        string          xpath = "";

        xpath = "/monster//" + monsterName + "/level[" + (skill) + "]";
        XmlElement node = (XmlElement)xmlDocMonsterSkill.SelectSingleNode(xpath);

        if (node == null)
        {
            Debug.Log("On CharacterReader GetMonsterSkillTargetType: " + monsterName + " skill" + (skill) + " not found");
            return(data);
        }
        if (node["target"] != null)
        {
            data = (SkillTargetType)System.Enum.Parse(typeof(SkillTargetType), (node["target"].InnerXml));
        }
        return(data);
    }
コード例 #9
0
ファイル: SkillHit.cs プロジェクト: midgithub/ProjectC
    public static void Hit(Character cha, int hitID, SkillContext context)
    {
        excel_skill_hit hitExcel = excel_skill_hit.Find(hitID);

        if (hitExcel == null)
        {
            return;
        }

        SkillHitShape   type       = (SkillHitShape)hitExcel.hitType;
        SkillTargetType targetType = (SkillTargetType)hitExcel.targetType;

        float data1  = (float)hitExcel.hitData1 * 0.001f;
        float data2  = (float)hitExcel.hitData2 * 0.001f;
        float height = (float)hitExcel.hitData3 * 0.001f;

        bool hitMultiple = hitExcel.hitType >= 3;

        List <Character> targets = new List <Character>();

        if (!hitMultiple)
        {
            Character skillTarget = context.SkillTarget;
            if (skillTarget == null)
            {
                return;
            }
            if (!IsMayHit(skillTarget, context, hitExcel))
            {
                return;
            }
            if (!CheckTargetType(cha, skillTarget, targetType))
            {
                return;
            }
            targets.Add(skillTarget);
        }
        else
        {
            Scene scn = cha.mScene;
            for (int i = 0; i < scn.GetCharacterCount(); ++i)
            {
                Character c = scn.GetCharacterByIndex(i);
                if (c == null)
                {
                    continue;
                }
                if (!IsMayHit(c, context, hitExcel))
                {
                    return;
                }
                if (!CheckTargetType(cha, c, targetType))
                {
                    continue;
                }
                targets.Add(c);
            }
        }

        Vector3 srcPosition = context.mOwner.Position;
        Vector3 srcForward  = context.mOwner.Direction;

        int hitCount = 0;

        for (int i = 0; i < targets.Count; ++i)
        {
            Character target = targets[i];
            switch (type)
            {
            case SkillHitShape.FanSingle:
            case SkillHitShape.FanMultiple:
            {
                if (Hit_Fan(srcPosition, srcForward, target, data1, data2 * 1000.0f, height))
                {
                    ++hitCount;
                    context.mHitTarget = target;
                    OnHit(context.mOwner, target, hitExcel);
                    AddHitCount(target, context, hitExcel);
                }
            }
            break;

            case SkillHitShape.RectSingle:
            case SkillHitShape.RectMultiple:
            {
                if (Hit_Rect(srcPosition, srcForward, target, data1, data2, height))
                {
                    ++hitCount;
                    context.mHitTarget = target;
                    OnHit(context.mOwner, target, hitExcel);
                    AddHitCount(target, context, hitExcel);
                }
            }
            break;

            case SkillHitShape.CircleSingle:
            case SkillHitShape.CircleMultiple:
            {
                if (Hit_Circle(srcPosition, target, data1, height))
                {
                    ++hitCount;
                    context.mHitTarget = target;
                    OnHit(context.mOwner, target, hitExcel);
                    AddHitCount(target, context, hitExcel);
                }
            }
            break;
            }
            if (hitExcel.maxHitCount > 0 && hitCount > hitExcel.maxHitCount)
            {
                break;
            }
        }
    }
コード例 #10
0
 public SkillTargetInfo(SkillTargetType type)
 {
     Targets = new List <FormationUnit>();
     Type    = type;
 }
コード例 #11
0
 public SkillTargetInfo(FormationUnit target, SkillTargetType type)
 {
     Targets = new List <FormationUnit>();
     Targets.Add(target);
     Type = type;
 }
コード例 #12
0
 public SkillTargetInfo(List <FormationUnit> targets, SkillTargetType type)
 {
     Targets = targets;
     Type    = type;
 }
コード例 #13
0
    public void OnPointerEnterAttack(int which)
    {
        if (currentStatus != Status.Rest)
        {
            return;
        }

        if (which == 0)
        {
            hexMap.ProbeAttackTarget(selectedPawn.currentCell);
            hexMap.ShowReachableEnemyCells();
        }
        else
        {
            Monster         monster = (Monster)selectedPawn;
            SkillTargetType type    = SkillTargetType.None;
            int             range   = -1;

            if (which == 1)
            {
                type  = characterReader.GetMonsterSkillTargetType(monster.Name, monster.defaultSkill);
                range = characterReader.GetMonsterSkillRange(monsterManager.GetMonsterUnlockLevel(monster.monsterType), monster.Name, monster.defaultSkill, monster.level);
            }
            else if (which == 2)
            {
                type  = characterReader.GetMonsterSkillTargetType(monster.Name, monster.equippedSkill);
                range = characterReader.GetMonsterSkillRange(monsterManager.GetMonsterUnlockLevel(monster.monsterType), monster.Name, monster.equippedSkill, monster.level);
            }

            if (range < 0)
            {
                return;
            }

            hexMap.ProbeAttackTarget(selectedPawn.currentCell, range);
            switch ((int)type)
            {
            case (int)SkillTargetType.Enemy:
                hexMap.ShowReachableEnemyCells();
                break;

            case (int)SkillTargetType.Friend:
                hexMap.ShowReachableFriendCells();
                break;

            case (int)SkillTargetType.Building:
                hexMap.ShowReachableBuildingCells();
                break;

            case (int)SkillTargetType.Empty:
                hexMap.ShowReachableEmptyCells();
                break;

            case (int)SkillTargetType.Self:
                hexMap.ShowReachableFriendCells();
                break;

            default:
                break;
            }
        }
    }
コード例 #14
0
ファイル: Skill.cs プロジェクト: DakEnviy/homm
 public Skill(string name, SkillSourceType sourceType, SkillTargetType targetType)
 {
     _name       = name;
     _sourceType = sourceType;
     _targetType = targetType;
 }
コード例 #15
0
        public T Get <T>(GameObject target, ElementalType elemental, SkillCategory skillCategory, SkillTargetType skillTargetType) where T : SkillVFX
        {
            var position = target.transform.position;
            var size     = "m";

            if (skillCategory == SkillCategory.AreaAttack)
            {
                size = "l";
                var pos = ActionCamera.instance.Cam.ScreenToWorldPoint(
                    new Vector2((float)Screen.width / 2, 0));
                position.x = pos.x + 0.5f;
                position.y = Stage.StageStartPosition;
            }

            var skillName = $"{skillCategory}_{size}_{elemental}".ToLower();

            if (skillCategory == SkillCategory.BlowAttack &&
                skillTargetType == SkillTargetType.Enemies)
            {
                skillName = $"{skillCategory}_m_{elemental}_area".ToLower();
            }
            else
            {
                position.x -= 0.2f;
                position.y += 0.32f;
            }
            var go = _pool.Get(skillName, false, position) ??
                     _pool.Get(skillName, true, position);

            return(GetEffect <T>(go, target));
        }
コード例 #16
0
ファイル: SkillHandle.cs プロジェクト: midgithub/ProjectC
    public static SkillResult UseSkill(SkillHandle handle)
    {
        if (handle.caster == null || handle.caster.IsCannotFlag(CannotFlag.CannotSkill))
        {
            return(SkillResult.InvalidCaster);
        }
        Skill lastSkill = handle.caster.GetSkill();

        if (lastSkill != null)
        {
            SkillStage stage = lastSkill.mCurStage;
            if (stage != null)
            {
                if (SkillStage.IsStageTrait(SkillStageTrait.WaitBreakStage, stage.mStageInfo))
                {
                    if (stage.mStageEnd == null)
                    {
                        WaitBreakStage onStageEnd = new WaitBreakStage();
                        onStageEnd.nextSkillHandle = handle;
                        stage.SetBreak(SkillBreakType.OtherSkill, false, onStageEnd.OnStageEnd);
                    }

                    return(SkillResult.CannotBreak);
                }
                if (!SkillStage.IsStageTrait(SkillStageTrait.BreakSelf, stage.mStageInfo) &&
                    lastSkill.SkillID == handle.skillID)
                {
                    return(SkillResult.CannotBreak);
                }
                if (!SkillStage.IsStageTrait(SkillStageTrait.SkillBreak, stage.mStageInfo))
                {
                    return(SkillResult.CannotBreak);
                }
            }
        }

        excel_skill_list skillExcel = excel_skill_list.Find(handle.skillID);

        if (skillExcel == null)
        {
            return(SkillResult.ExcelNotExist);
        }
        Character target = handle.caster.mScene.FindCharacter(handle.skillTargetID);

        SkillTargetType targetType = (SkillTargetType)skillExcel.targetType;

        if (targetType != SkillTargetType.All)
        {
            if (target == null)
            {
                return(SkillResult.InvalidTarget);
            }
            if (targetType == SkillTargetType.Enemy && !CampSystem.IsEnemy(handle.caster, target))
            {
                return(SkillResult.InvalidTarget);
            }
            if (targetType == SkillTargetType.Friend && !CampSystem.IsFriend(handle.caster, target))
            {
                return(SkillResult.InvalidTarget);
            }
        }
        if (target == null && skillExcel.maxDistance > 0.0f)
        {
            return(SkillResult.InvalidTarget);
        }

        SkillContext context = new SkillContext();

        context.mSkillID      = handle.skillID;
        context.mOwner        = handle.caster;
        context.SkillTargetID = handle.skillTargetID;
        if (!handle.autoTargetPos)
        {
            context.TargetPos = handle.targetPos;
        }
        else
        {
            context.TargetPos = target == null ? Vector3.zero : target.Position;
        }
        Skill skill = new Skill(handle.skillID, context);

        handle.caster.SetSkill(skill);
        skill.mSkillEnd = handle.skillEndMethod;

        ReqSkill notifyMsg = new ReqSkill();

        notifyMsg.skillID       = handle.skillID;
        notifyMsg.casterID      = handle.caster.gid;
        notifyMsg.targetID      = handle.skillTargetID;
        notifyMsg.autoTargetPos = handle.autoTargetPos;
        notifyMsg.targetPos     = Vector3Packat.FromVector3(handle.targetPos);
        notifyMsg.position      = Vector3Packat.FromVector3(handle.caster.Position);
        notifyMsg.direction     = Vector3Packat.FromVector3(handle.caster.Direction);

        for (int i = 0; i < handle.caster.mScene.GetPlayerCount(); ++i)
        {
            Player player = handle.caster.mScene.GetPlayerByIndex(i);
            NetWork.NotifyMessage(player.UserID, STC.STC_SkillNotify, notifyMsg);
        }

        return(SkillResult.Success);
    }