예제 #1
0
    //private Rigidbody2D rb;

    // Use this for initialization
    void Start()
    {
        canMove = true;

        playerBase = GameObject.Find("PlayerBase");
        enemyBase  = GameObject.Find("EnemyBase");
        Neutral1   = GameObject.Find("NeutralBase1");
        Neutral2   = GameObject.Find("NeutralBase2");

        base1           = Neutral1.GetComponent <BaseStatus>();
        base2           = Neutral2.GetComponent <BaseStatus>();
        baseManager     = GameObject.Find("BaseManager").GetComponent <BaseManager>();
        unitCreateStart = GameObject.Find("GameSystem").GetComponent <UnitCreateStart>();

        rot   = true;
        rotP  = false;
        rotN1 = true;
        rotN2 = true;

        modenum = 1;
        if (gameObject.tag == "WizardUnit")
        {
            magicModeChange = GetComponent <MagicModeChange>();
            StartCoroutine("modechange");
        }
        else
        {
            magicModeChange = null;
        }
    }
예제 #2
0
 //  Initialization --------------------------------
 public void Init(BaseStatus status, int expiredRound)
 {
     Status       = status;
     ExpiredRound = expiredRound;
     _player      = TurnDirector.Ins.GetPlayerHaveTurn();
     StartListen();
 }
예제 #3
0
 public void Activate(BaseStatus status)
 {
     if (status.Type == "Negative")
     {
         targetPlayer.RemoveStatus(status);
         //targetPlayer.RemoveStatus(this);
     }
 }
예제 #4
0
 public static MasterModel Create(this BaseStatus baseStatus)
 {
     return(new MasterModel
     {
         Id = baseStatus.Id,
         Name = baseStatus.Name
     });
 }
예제 #5
0
 public void SwitchStatus(Type nextStatus)
 {
     if (availableStatuses.TryGetValue(nextStatus, out BaseStatus value))
     {
         currentStatus = value;
         currentStatus.OnEnable();
     }
 }
예제 #6
0
 //MasterModel with polymorphism for all statuses
 public static MasterModel Master(this BaseStatus status)
 {
     return(new MasterModel
     {
         Id = status.Id,
         Name = status.Name
     });
 }
예제 #7
0
    private void Logic_OnStatusRemoved(Mingming mingming, BaseStatus status)
    {
        var effectStatus = status as EffectStatus;

        if (effectStatus != null)
        {
            TurnStateMachine[effectStatus.TurnState].RemoveListener(effectStatus.GetEffect(mingming.Logic));
        }
    }
예제 #8
0
 //  Initialization --------------------------------
 public void Set(MerchantTag tagName, string name, BaseSkill skill, BaseStatus passive, int maxMana, string story)
 {
     _tagName      = tagName;
     _name         = name;
     _skill        = skill;
     _passiveSkill = passive;
     _maxMana      = maxMana;
     Story         = story;
 }
예제 #9
0
        public static bool Insert(BaseStatus baseStatus, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
INSERT INTO T_BASE_STATUS(STATUS_ID,STATUS_NAME,GROUP_NAME,CREATED_ON,CREATED_BY)
VALUES(@StatusId,@StatusName,@GroupName,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy)

";

            return(Dapper.Save(baseStatus, sql, conn, trans));
        }
예제 #10
0
        public static bool Delete(BaseStatus baseStatus)
        {
            const string sql = @"
DELETE FROM T_BASE_STATUS
WHERE ID=@ID

";

            return(Dapper.Save(baseStatus, sql));
        }
예제 #11
0
        public static bool Delete(BaseStatus baseStatus, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
DELETE FROM T_BASE_STATUS
WHERE ID=@ID

";

            return(Dapper.Save(baseStatus, sql, conn, trans));
        }
예제 #12
0
        public static bool Update(BaseStatus baseStatus, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
UPDATE T_BASE_STATUS
SET STATUS_ID=@StatusId,STATUS_NAME=@StatusName,GROUP_NAME=@GroupName,CREATED_BY=@CreatedBy
WHERE ID=@ID

";

            return(Dapper.Save(baseStatus, sql, conn, trans));
        }
예제 #13
0
            static public void  CreateStatusObject <T>(BaseStatus _status) where T : BaseStatus
            {
                BaseStatus baseStatus = CreateInstance <T>();

                baseStatus = _status;

                string debug = "Assets/Main/Data/" + baseStatus.GetCharacterType.ToString() + "/" + baseStatus.GetName + ".asset";

                AssetDatabase.CreateAsset(baseStatus, "Assets/Main/Data/" + baseStatus.GetCharacterType.ToString() + "/" + baseStatus.GetName + ".asset");
                AssetDatabase.Refresh();
            }
예제 #14
0
    // 敵の攻撃処理
    public void EnemyAttack(GameObject character)
    {
        CharacterBattle characterBattleScript = character.GetComponent <CharacterBattle>();
        BaseStatus      characterStatus       = characterBattleScript.GetCharacterStatus();

        if (characterStatus.GetSkillList().Count <= 0)
        {
            return;
        }
        // 敵の行動アルゴリズム
        int randomValue = (int)(Random.value * characterStatus.GetSkillList().Count);
        var nowSkill    = characterStatus.GetSkillList()[randomValue];

        // テスト用(特定のスキルで確認)
        //nowSkill = characterStatus.GetSkillList()[0];

        if (nowSkill.GetSkillType() == Skill.Type.DirectAttack)
        {
            var targetNum = (int)(Random.value * allyCharacterInBattleList.Count);
            // 攻撃相手のCharacterBattleScript
            characterBattleScript.ChooseAttackOptions(CharacterBattle.BattleState.DirectAttack, allyCharacterInBattleList[targetNum], nowSkill);
        }
        else if (nowSkill.GetSkillType() == Skill.Type.MagicAttack)
        {
            var targetNum = (int)(Random.value * allyCharacterInBattleList.Count);
            if (characterBattleScript.GetMp() >= ((Magic)nowSkill).GetAmountToUseMagicPoints())
            {
                // 攻撃相手のCharacterBattleScript
                characterBattleScript.ChooseAttackOptions(CharacterBattle.BattleState.MagicAttack, allyCharacterInBattleList[targetNum], nowSkill);
            }
            else
            {
                // MPが足りない場合は直接攻撃を行う
                ShowMessage("MPが足りない!");
                characterBattleScript.ChooseAttackOptions(CharacterBattle.BattleState.DirectAttack, allyCharacterInBattleList[targetNum], characterStatus.GetSkillList().Find(skill => skill.GetSkillType() == Skill.Type.DirectAttack));
            }
        }
        else if (nowSkill.GetSkillType() == Skill.Type.RecoveryMagic)
        {
            if (characterBattleScript.GetMp() >= ((Magic)nowSkill).GetAmountToUseMagicPoints())
            {
                var targetNum = (int)(Random.value * enemyCharacterInBattleList.Count);
                // 回復相手のCharacterBattleScript
                characterBattleScript.ChooseAttackOptions(CharacterBattle.BattleState.Healing, enemyCharacterInBattleList[targetNum], nowSkill);
            }
            else
            {
                ShowMessage("MPが足りない!");
                var targetNum = (int)(Random.value * allyCharacterInBattleList.Count);
                // MPが足りない場合は直接攻撃を行う
                characterBattleScript.ChooseAttackOptions(CharacterBattle.BattleState.DirectAttack, allyCharacterInBattleList[targetNum], characterStatus.GetSkillList().Find(skill => skill.GetSkillType() == Skill.Type.DirectAttack));
            }
        }
    }
예제 #15
0
        /// <summary>
        /// When Base zone is updated reflect changes in UI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateStatus(BaseStatus status)
        {
            switch (status)
            {
            case BaseStatus.Nothing:
                DisplayStatus.text = String.Empty;
                break;

            case BaseStatus.Flying:
                DisplayStatus.text = flying;
                break;
            }
        }
예제 #16
0
 // データの更新
 public void UpdateStatus(BaseStatus characterStatus, Status status, int destinationValue)
 {
     if (status == Status.HP)
     {
         characterStatusDictionary[characterStatus].Find("HPSlider").GetComponent <Slider>().value     = (float)destinationValue / characterStatus.GetMaxHp();
         characterStatusDictionary[characterStatus].Find("HPSlider/HPText").GetComponent <Text>().text = destinationValue.ToString();
     }
     else if (status == Status.MP)
     {
         characterStatusDictionary[characterStatus].Find("MPSlider").GetComponent <Slider>().value     = (float)destinationValue / characterStatus.GetMaxMp();
         characterStatusDictionary[characterStatus].Find("MPSlider/MPText").GetComponent <Text>().text = destinationValue.ToString();
     }
 }
예제 #17
0
    public void SetBotStatus <T>() where T : BaseStatus, new()
    {
        if (CurBotStatus != null)
        {
            CurBotStatus.Deactivate();
        }

        var baseStatus = new T();

        baseStatus.Bot = this;
        baseStatus.Activate();
        CurBotStatus = baseStatus;
    }
예제 #18
0
    public static string GetColoredStatus(BaseStatus Status)
    {
        if (Status == BaseStatus.Active)
        {
            return("<span class=\"text-success\">" + L1.ACTIVE + "</span>");
        }

        if (Status == BaseStatus.Hidden)
        {
            return("<span class=\"text-warning\">Hidden</span>");
        }

        return(""); //for compilator
    }
예제 #19
0
    // キャラクターの攻撃の選択処理
    public void MakeAttackChoise(GameObject character)
    {
        BaseStatus characterStatus = character.GetComponent <CharacterBattle>().GetCharacterStatus();

        // EnemyStatusにキャスト出来る場合は敵の攻撃処理
        if (characterStatus as EnemyStatus != null)
        {
            EnemyAttack(character);
        }
        else
        {
            AllyAttack(character);
        }
    }
예제 #20
0
파일: BaseUnit.cs 프로젝트: hmason55/B
    public void AddStatus(BaseStatus newStatus)
    {
        BaseStatus oldStatus = SearchStatusLike(newStatus.GetType());

        if (oldStatus == null)
        {
            _statuses.Add(newStatus);
        }
        else
        {
            oldStatus.Update(newStatus);
            newStatus.DestroyStatusExecute();
        }
        UpdateUI();
    }
예제 #21
0
    // Use this for initialization
    void Start()
    {
        baseStatus = GetComponent <BaseStatus>();
        sprites    = new SpriteRenderer[3];
        int i = 0;

        foreach (Transform child in transform)
        {
            sprites[i] = child.gameObject.GetComponent <SpriteRenderer>();
            if (sprites[i] != null)
            {
                i++;
            }
        }
    }
예제 #22
0
        public async Task CheckAreWeStillOnTheRoadAsync()
        {
            if (waypointChecker.TollPoint != null)
            {
                Debug.WriteLine(waypointChecker.TollPoint.Name);
                BaseStatus statusObject = StatusesFactory.GetStatus(TollStatus);
                _textToSpeech.IsEnabled = true;

                switch (_storedSettingsService.CurrentRoadStatus)
                {
                case TollGeolocationStatus.NearTollRoadEntrance:
                case TollGeolocationStatus.NotOnTollRoad:
                    break;

                case TollGeolocationStatus.NearTollRoadExit:
                case TollGeolocationStatus.OnTollRoad:
                    if (await statusObject.SpeechToTextService.AskQuestionAsync($"Are you still going from {waypointChecker.TollPoint.Name} tollroad?"))
                    {
                        waypointChecker.SetEntrance(waypointChecker.TollPoint);

                        if (waypointChecker.TollPoint.WaypointAction == WaypointAction.Bridge)
                        {
                            waypointChecker.SetExit(waypointChecker.TollPoint);

                            waypointChecker.SetTollPointsInRadius(null);
                            waypointChecker.ClearData();
                            TollStatus = Mvx.Resolve <IStoredSettingsService>().CurrentRoadStatus == TollGeolocationStatus.OnTollRoad
                                               ? Mvx.Resolve <IStoredSettingsService>().CurrentRoadStatus
                                               : TollGeolocationStatus.NotOnTollRoad;
                        }
                        else
                        {
                            TollStatus = TollGeolocationStatus.OnTollRoad;
                        }
                    }
                    else
                    {
                        TollStatus = TollGeolocationStatus.NotOnTollRoad;
                        Mvx.Resolve <IStoredSettingsService>().CurrentRoadStatus = TollStatus;
                    }
                    break;
                }
            }
        }
예제 #23
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        AttackRange attckRange = collision.gameObject.GetComponent <AttackRange>();

        if (attckRange != null && candamage == true)
        {
            UnitStatus ustatus = collision.gameObject.GetComponent <UnitStatus>();
            if (ustatus.unitCheck != unitStatus.unitCheck)
            {
                candamage = false;
                ustatus.AddDamage(unitStatus.unitPower);
                StartCoroutine("Span");
            }
        }

        UnitStatus status = GetComponent <UnitStatus>();

        if (status != null)
        {
            if (collision.gameObject.tag == "Base" && candamage == true && status.unitCheck == false)
            {
                candamage = false;
                BaseStatus baseStatus = collision.gameObject.GetComponent <BaseStatus>();
                if (baseStatus != null)
                {
                    baseStatus.damage(unitStatus.unitPower);
                    StartCoroutine("Span");
                }
            }

            /*
             * else if (collision.gameObject.name == "EnemyBase" && candamage == true && status.unitCheck == true)
             * {
             *  candamage = false;
             *  BaseStatus baseStatus = collision.gameObject.GetComponent<BaseStatus>();
             *  baseStatus.damage(unitStatus.unitPower);
             *  StartCoroutine("Span");
             * }
             */
        }
    }
    public override void Initialize()
    {
        currentEventData  = (GameSection.GetEventData() as object[]);
        equipSet          = (currentEventData[0] as EquipSetInfo);
        abilityCollection = (currentEventData[1] as EquipItemAbilityCollection[]);
        baseStatus        = (currentEventData[2] as BaseStatus);
        EquipItemInfo[] item = equipSet.item;
        foreach (EquipItemInfo equipItemInfo in item)
        {
            if (equipItemInfo != null)
            {
                AbilityItemInfo abilityItem = equipItemInfo.GetAbilityItem();
                if (abilityItem != null)
                {
                    abilityItems.Add(abilityItem);
                }
            }
        }
        Array.Sort(abilityCollection, delegate(EquipItemAbilityCollection l, EquipItemAbilityCollection r)
        {
            if (r.ability.ap != l.ability.ap)
            {
                return(r.ability.ap - l.ability.ap);
            }
            return((int)(l.ability.id - r.ability.id));
        });
        isEquipSubWeapon = (equipSet.item[1] != null || equipSet.item[2] != null);
        selectEquipIndex = 0;
        SetSupportEncoding(UI.LBL_HP, true);
        SetSupportEncoding(UI.LBL_ATK, true);
        SetSupportEncoding(UI.LBL_DEF, true);
        int j = 0;

        for (int num = uiAtkElem.Length; j < num; j++)
        {
            SetSupportEncoding(uiAtkElem[j], true);
            SetSupportEncoding(uiDefElem[j], true);
        }
        InitializeCaption();
        base.Initialize();
    }
예제 #25
0
    // 選択肢から選んだモードを実行
    public void ChooseAttackOptions(BattleState selectOption, GameObject target, Skill skill = null, Item item = null)
    {
        // スキルやターゲットの情報をセット
        currentTarget = target;
        currentSkill  = skill;
        targetCharacterBattleScript = target.GetComponent <CharacterBattle>();
        targetBaseStatus            = targetCharacterBattleScript.GetCharacterStatus();

        // 選択したキャラクターの状態を設定
        battleState = selectOption;

        if (selectOption == BattleState.DirectAttack)
        {
            battleManager.ShowMessage(gameObject.name + "は" + currentTarget.name + "に" + currentSkill.GetKanjiName() + "を行った。");
        }
        else if (selectOption == BattleState.MagicAttack ||
                 selectOption == BattleState.Healing ||
                 selectOption == BattleState.IncreaseAttackPowerMagic ||
                 selectOption == BattleState.IncreaseDefencePowerMagic
                 )
        {
            // 魔法使用者のMPを減らす
            SetMp(GetMp() - ((Magic)skill).GetAmountToUseMagicPoints());
            battleManager.ShowMessage(gameObject.name + "は" + currentTarget.name + "に" + currentSkill.GetKanjiName() + "を使った。");
            // 使用者が味方キャラクターであればStatusPanelの更新
            if (GetCharacterStatus() as AllyStatus != null)
            {
                battleStatusScript.UpdateStatus(GetCharacterStatus(), BattleStatus.Status.MP, GetMp());
            }
            //Instantiate(((Magic)skill).GetSkillUserEffect(), transform.position, ((Magic)skill).GetSkillUserEffect().transform.rotation);
        }
        else if (selectOption == BattleState.UseHPRecoveryItem ||
                 selectOption == BattleState.UseMPRecoveryItem ||
                 selectOption == BattleState.UseParalyzeRecoveryItem ||
                 selectOption == BattleState.UsePoisonRecoveryItem
                 )
        {
            currentItem = item;
            battleManager.ShowMessage(gameObject.name + "は" + currentTarget.name + "に" + item.GetKanjiName() + "を使った。");
        }
    }
예제 #26
0
            private void CreateCharacterStatus(BaseStatus.Character _character)
            {
                BaseStatus status;

                switch (_character)
                {
                case BaseStatus.Character.Player:
                    status = new StatusPlayer();
                    status.SetStatus(hp_, mp_, attack_, speed_, name_, startLevel_, ID_);
                    BaseStatus.CreateStatusObject <StatusPlayer>(status);
                    break;

                case BaseStatus.Character.Enemy:
                    status = new StatusEnemy();
                    status.SetStatus(hp_, mp_, attack_, speed_, name_, startLevel_, ID_);
                    BaseStatus.CreateStatusObject <StatusEnemy>(status);
                    break;

                default:
                    status = new BaseStatus();
                    break;
                }
            }
예제 #27
0
파일: BlockStatus.cs 프로젝트: hmason55/B
 public override void Update(BaseStatus newStatus)
 {
     Strength += newStatus.Strength;
     Duration  = newStatus.Duration;
 }
예제 #28
0
파일: Card.cs 프로젝트: hmason55/B
    void ApplyToTile(int tile, Effect effect)
    {
        // Get list of valid tiles
        List <int> targetTiles;

        if (areaOfEffect)
        {
            targetTiles = Battleground.Instance.GetTilesFromShape(targetArea, tile);
        }
        else
        {
            targetTiles = new List <int> {
                tile
            }
        };

        Debug.Log("tiles number: " + targetTiles.Count);
        switch (effect.effectType)
        {
        case EffectType.Miasma:


            // Spawn miasma on tiles
            foreach (int t in targetTiles)
            {
                MiasmaFieldEffect miasma = new MiasmaFieldEffect(effect.effectValue, effect.duration, owner, t);
                Battleground.Instance.AddFieldEffect(t, miasma);
            }
            break;

        case EffectType.Damage:
            float mult = 1.00f;
            for (int i = owner.Statuses.Count - 1; i >= 0; i--)
            {
                BaseStatus status = owner.Statuses[i];
                if (status.GetType() == typeof(DamageMultiplierStatus))
                {
                    mult += status.Multiplier;

                    // Remove multiplier status
                    // TODO change if the status can have more than 1 use
                }
            }
            foreach (int t in targetTiles)
            {
                BaseUnit target = Battleground.Instance.GetUnitOnTile(t);

                if (target == null)
                {
                    continue;
                }
                if (ParseTargetType(TargetType.Enemy, target.IsPlayer()))
                {
                    int damage = (int)Math.Round(effect.effectValue * mult);
                    target.DealDamage(damage, owner);

                    owner.RemoveStatusOfType(typeof(DamageMultiplierStatus));
                    owner.UpdateUI();

                    // Add threat to player units
                    if (owner.IsPlayer())
                    {
                        PartyManager.Instance.ChangeThreat(owner, damage * 0.01f);
                    }
                }
            }
            break;
        }
    }

    void ApplyToTargets(BaseUnit[] targets, Effect effect)
    {
        Debug.Log("Applying effects");

        // Apply effects to specifically targeted units (dragged card onto or put AoE targeter on).
        switch (effect.effectType)
        {
        case EffectType.Damage:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    float mult = 1.00f;
                    for (int i = owner.Statuses.Count - 1; i >= 0; i--)
                    {
                        BaseStatus status = owner.Statuses[i];
                        if (status.GetType() == typeof(DamageMultiplierStatus))
                        {
                            mult += status.Multiplier;

                            // Remove multiplier status
                            // TODO change if the status can have more than 1 use
                            owner.RemoveStatusOfType(status.GetType());
                            owner.UpdateUI();
                        }
                    }

                    int damage = (int)Math.Round(effect.effectValue * mult);
                    target.DealDamage(damage, owner);

                    // Add threat to player units
                    if (owner.IsPlayer())
                    {
                        PartyManager.Instance.ChangeThreat(owner, damage * 0.01f);
                    }
                }
            }
            break;

        case EffectType.Block:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    BlockStatus blockStatus = new BlockStatus(effect.effectValue, effect.duration, owner, owner);
                    target.AddStatus(blockStatus);
                }
            }
            break;

        case EffectType.Taunt:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    TauntStatus taunt = new TauntStatus(effect.duration, owner, target);
                    target.AddStatus(taunt);
                }
            }
            break;

        case EffectType.Stun:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    StunStatus stun = new StunStatus(effect.duration, owner, target);
                    target.AddStatus(stun);
                }
            }
            break;

        case EffectType.Push:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    // check if not on last col
                    List <int> pushTiles = Battleground.Instance.FindEmptyTileNear(target.GetGridPosition());
                    if (pushTiles.Count < 1)
                    {
                        return;
                    }
                    int nextPos = pushTiles[UnityEngine.Random.Range(0, pushTiles.Count)];
                    target.MoveToTile(nextPos);

                    if (owner.IsPlayer())
                    {
                        PartyManager.Instance.ChangeThreat(owner, 0.05f);
                    }
                }
            }
            break;

        case EffectType.SummonVoodoo:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    // Create voodoo unit
                    GameObject voodooPrefab = Resources.Load <GameObject>("Prefabs/Units/Voodoo");
                    Debug.Log(voodooPrefab);
                    BaseUnit   voodoo      = Instantiate(voodooPrefab).GetComponent <BaseUnit>();
                    List <int> voodooTiles = Battleground.Instance.FindEmptyTileNear(target.GetGridPosition());
                    int        voodooPos   = voodooTiles[UnityEngine.Random.Range(0, voodooTiles.Count)];
                    Battleground.Instance.PlaceUnitAt(voodoo, voodooPos);

                    // Add status to transfer damage
                    HealthLinkStatus healthLinkstatus = new HealthLinkStatus(1.0f, owner, target);
                    voodoo.AddStatus(healthLinkstatus);
                }
            }
            break;

        case EffectType.Weakness:
            foreach (BaseUnit target in targets)
            {
                if (ParseTargetType(effect.targetType, target.IsPlayer()))
                {
                    WeaknessStatus weaknessStatus = new WeaknessStatus(0.01f * effect.effectValue, effect.duration, owner, target);
                    target.AddStatus(weaknessStatus);
                }
            }
            break;
        }
    }
예제 #29
0
파일: PoisonStatus.cs 프로젝트: hmason55/B
 public override void Update(BaseStatus newStatus)
 {
     // Sum duration and strength
     Strength += newStatus.Strength;
     Duration += newStatus.Strength;
 }
예제 #30
0
 public EmpathyStatus(BaseStatus identifier, string message)
 {
     this.identifier = identifier;
     this.message = message;
 }
예제 #31
0
 // What happens with another identical status is applied
 public abstract void Update(BaseStatus newStatus);