private void StartResolvingOneCard(IPlayedCard played)
    {
        BattleLog.Write($"Began resolving {played.Card.Name}");
        if (physicalZone.Count == 0)
        {
            Log.Info($"Weird Physical Zone Draw bug.");
        }
        else
        {
            physicalZone.DrawOneCard();
        }

        var card = played.Card;

        if (card.Owner.IsStunnedForCard())
        {
            BattleLog.Write($"{card.Owner.Name} was stunned, so {card.Name} does not resolve.");
            card.Owner.Apply(m => m.ApplyTemporaryAdditive(AdjustedStats.CreateIndefinite(new StatAddends().With(TemporalStatType.CardStun, -1), true)));
            WrapupCard(played, card);
            Message.Publish(new CardResolutionFinished());
        }
        else
        {
            AllConditions.InitCardPlaying(battleState.GetSnapshot());
            played.Perform();
            WrapupCard(played, card);
        }
    }
示例#2
0
    void Update()
    {
        if (itemToCheck == true && DragHandeler.itemBeingDragged == null)
        {
            foreach (Item i in actionate)
            {
                if (i == DragHandeler.lastDragged)
                {
                    foreach (Condition co in AllConditions.GetConditions())
                    {
                        foreach (string con in conditions)
                        {
                            if (co.description == con)
                            {
                                co.satisfied = true;
                            }
                        }
                    }
                    p.OnInteractableClick(this);
                }
            }
        }

        itemToCheck = false;
    }
示例#3
0
    private static void CreateAllConditionsAsset()
    {
        AllConditions instance = CreateInstance <AllConditions>();

        AssetDatabase.CreateAsset(instance, creationPath);

        AllConditions.Instance = instance;

        instance.conditions = new Condition[0];
    }
示例#4
0
 public bool Check()
 {
     for (int i = 0; i < requiredConditions.Length; i++)
     {
         if (!AllConditions.CheckCondition(requiredConditions[i]))
         {
             return(false);
         }
     }
     return(true);
 }
示例#5
0
    private void OnEnable()
    {
        allConditions = (AllConditions)target;  //zawsze w OnEnable trzeba cacheowac target

        if (allConditions.conditions == null)
        {
            allConditions.conditions = new Condition[0];
        }
        if (conditionEditors == null)
        {
            CreateEditors();
        }
    }
示例#6
0
    // 진행상태(Condition) 저장
    private void SaveCondition()
    {
        // 이전 값 제거
        tempData.conditionsCheck.Clear();

        // 현재의 상태를 저장
        AllConditions allConditions = Resources.Load <AllConditions>("AllConditions");

        foreach (Condition condition in allConditions.conditions)
        {
            tempData.conditionsCheck.Add(condition.satisfied);
        }
    }
    private void OnEnable()
    {
        allConditions = (AllConditions)target;

        if (allConditions.conditions == null)
        {
            allConditions.conditions = new Condition[0];
        }

        if (conditionEditors == null)
        {
            CreateEditors();
        }
    }
    public bool CheckAndReact()
    {
        if (requiredConditions.Any(rc => !AllConditions.CheckCondition(rc)))
        {
            return(false);
        }

        if (reactionCollection)
        {
            reactionCollection.React();
        }

        return(true);
    }
示例#9
0
 public void SkipReaction()
 {
     for (int i = 0; i < requiredConditions.Length; i++)
     {
         if (!AllConditions.CheckCondition(requiredConditions[i]))
         {
             return;
         }
     }
     if (reactionCollection)
     {
         reactionCollection.Skip();
     }
 }
示例#10
0
        public void SetAllLists(Manager manager)
        {
            if (SelectedModelId != 0)
            {
                var selectedModel = manager.GetModel(SelectedModelId);
                AllModels.Add(new SelectListItem {
                    Value = selectedModel.Id.ToString(), Text = selectedModel.Name
                });
            }
            //makes
            foreach (var make in manager.GetAllMakes())
            {
                AllMakes.Add(new SelectListItem {
                    Value = make.Id.ToString(), Text = make.Name
                });
            }
            //models

            //conditions
            foreach (var condition in manager.GetAllConditions())
            {
                AllConditions.Add(new SelectListItem {
                    Value = condition.Id.ToString(), Text = condition.Name
                });
            }

            //styles
            foreach (var style in manager.GetAllBodyStyles())
            {
                AllStyles.Add(new SelectListItem {
                    Value = style.Id.ToString(), Text = style.Name
                });
            }

            //colors
            foreach (var color in manager.GetAllColors())
            {
                AllColors.Add(new SelectListItem {
                    Value = color.Id.ToString(), Text = color.Name
                });
            }

            //transmissions
            foreach (var trans in manager.GetAllTransmissions())
            {
                AllTransmissions.Add(new SelectListItem {
                    Value = trans.Id.ToString(), Text = trans.Name
                });
            }
        }
示例#11
0
    /* initialize everything
     * creator:Yan Zhang, myles
     */
    void Start()
    {
        //set count to 0
        enemycount = 0;
        //get the current scene num
        sceneNum = SceneManager.GetActiveScene().buildIndex;
        //Load all the quest object in the scene
        GlobalControl.Instance.FindQuestObjectLoad(sceneNum);
        //set the portal interface for this scene
        SetUpPortal(sceneNum);
        //if it is village scene now
        //if the tutorial does happened put player in the beginnign of the village
        // if the tutorial happend enable all the npcs and disable all the screaming audio and fire in the scene
        if (sceneNum == 0)
        {
            //Debug.Log ("in village");
            if (!AllEventList.returnStatus("villageInitial", 0))
            {
                Player.instance.GetComponent <NavMeshAgent> ().enabled = false;
                Player.instance.transform.position = new Vector3(52.27f, 0.203f, 192.47f);
                Player.instance.GetComponent <NavMeshAgent> ().enabled = true;

                //Disable AI pathing
                GameObject.Find("Villager Paths").SetActive(false);
                GameObject.Find("Horse Paths").SetActive(false);

                //Music
                GameObject.Find("Village (Calm) Music").SetActive(false);
            }
            if (AllEventList.returnStatus("villageInitial", 0))
            {
                GameObject.FindWithTag("ScreamingVillagers").SetActive(false);
                GameObject.FindWithTag("Fire").SetActive(false);
                GameObject.FindWithTag("Villager").SetActive(false);
                villageElder.SetActive(true);
                witch.SetActive(true);

                //Music
                GameObject.Find("Village (Attack) Music").SetActive(false);

                initialText.SetActive(false);
            }
            // if a quest is complete need to set grand father enable
            if (AllConditions.returnCondition("Get the eternal flame"))
            {
                grandFather.SetActive(true);
            }
        }
    }
示例#12
0
        public Condition AddNewGroupClause()
        {
            var c = new Condition
            {
                ParentId      = Id,
                Id            = Guid.NewGuid(),
                AllConditions = AllConditions,
                ConditionName = QueryType.Group.ToString(),
                Comparison    = CompareType.AnyTrue.ToString(),
                Order         = MaxClauseOrder() + 2
            };

            AllConditions.Add(c.Id, c);
            return(c);
        }
示例#13
0
 public bool CheckAndReact()
 {
     for (int i = 0; i < requiredConditions.Length; i++)
     {
         if (!AllConditions.CheckCondition(requiredConditions[i]))
         {
             return(false);
         }
     }
     if (reactionCollection)
     {
         reactionCollection.React();
     }
     return(true);
 }
示例#14
0
        private void AllConditions_NodeClick(object sender, TreeNodeMouseEventArgs e)
        {
            Node node = e.Node;

            if (node.Tag is AbstractCondition)
            {
                AllConditions.BeginUpdate();
                selected = (AbstractCondition)node.Tag;
                ConditionEditor.Nodes.Clear();
                foreach (Node conNode in selected.GetNodes())
                {
                    ConditionEditor.Nodes.Add(conNode);
                }
                AllConditions.EndUpdate();
            }
        }
示例#15
0
    private static void CreateAllConditionsAsset()
    {
        if (AllConditions.Instance)
        {
            return;
        }

        AllConditions instance = CreateInstance <AllConditions>();

        AssetDatabase.CreateAsset(instance, creationPath);
        AssetDatabase.Refresh();

        AllConditions.Instance = instance;

        instance.conditions = new Condition[0];
    }
示例#16
0
        public Condition AddNewClause()
        {
            var c = new Condition
            {
                ParentId      = Id,
                Id            = Guid.NewGuid(),
                AllConditions = AllConditions,
                ConditionName = QueryType.MatchAnything.ToString(),
                Comparison    = CompareType.Equal.ToString(),
                Order         = MaxClauseOrder() + 2
            };

            NewMatchAnyId = c.Id;
            AllConditions.Add(c.Id, c);
            return(c);
        }
    public ReactionCollection reactionCollection;             // reakcje do zrealizowania


    public bool CheckAndReact()                             // musimy teraz sprawdzic i jesli konieczne to zareagowac, defaultowo bedzie zwracac true
    {
        for (int i = 0; i < requiredConditions.Length; i++) // musimy sprawdzic wszystkie nasze kondycje w for loop,
        {
            if (!AllConditions.CheckCondition(requiredConditions[i]))
            {
                return(false); //chcemy sprawdzac tylko czy jakis warunek NIE jest spełniony
            }
        }

        if (reactionCollection) // jezeli wszystkie warunki zostaly spelnione to trzeba wyzwolic funkcje React
        {
            reactionCollection.React();
        }

        return(true);
    }
示例#18
0
    private void OnEnable()
    {
        // Cache the reference to the target.
        allConditions = (AllConditions)target;

        // If there aren't any Conditions on the target, create an empty array of Conditions.
        if (allConditions.conditions == null)
        {
            allConditions.conditions = new Condition[0];
        }

        // If there aren't any editors, create them.
        if (conditionEditors == null)
        {
            CreateEditors();
        }
    }
    public bool CheckAndReact()
    {
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            if (!AllConditions.CheckCondition(requiredConditions[i]))  //Checks if all the conditions are met, if they are not then it returns false
            {
                return(false);
            }
        }

        if (ReactionCollection)
        {
            ReactionCollection.React(); //if the conditions have been met and there are some reactions, then call them
        }

        return(true);
    }
    //over write the die function
    public override void Die()
    {
        //change the condition in all condtion object
        AllConditions.ChangeCondition("Bring peace back to grave yard");
        //instatiate big gems from item database on the ground
        //set up the positions next to boss
        //ingnore the colliders on them
        GameObject gem = Instantiate(itemDB.items[1].itemPrefab);

        gem.transform.position = this.transform.position;
        Physics.IgnoreCollision(gem.GetComponent <Collider>(), GetComponent <Collider>());
        GameObject gem2 = Instantiate(itemDB.items[3].itemPrefab);

        gem2.transform.position = this.transform.position + new Vector3(2, 0, 2);
        Physics.IgnoreCollision(gem2.GetComponent <Collider>(), GetComponent <Collider>());
        base.Die();
    }
示例#21
0
    private static void CreateAllConditionsAsset()
    {
        // If there's already an AllConditions asset, do nothing.
        //if (AllConditions.Instance)
        //    return;

        // Create an instance of the AllConditions object and make an asset for it.
        AllConditions instance = CreateInstance <AllConditions>();

        AssetDatabase.CreateAsset(instance, creationPath);

        // Set this as the singleton instance.
        AllConditions.Instance = instance;

        // Create a new empty array of Conditions.
        instance.conditions = new Condition[0];
    }
    /*
     * Function: Use
     *
     * Description: get reference to player and playerstats then
     * call heal function to heal for amount of healthGain
     */
    public override void Use()
    {
        // Heal the player
        //player = PlayerManager.instance.player;
        if (this.itemID == 40)
        {
            Player.instance.playerStats.currentHealth += healthGain;
            Player.instance.playerStats.currentHealth  = Mathf.Clamp(Player.instance.playerStats.currentHealth, Player.instance.playerStats.currentHealth, Player.instance.playerStats.maxHealth);
        }
        else if (this.itemID == 52)
        {
            AllConditions.ChangeCondition("Drink The Potion");
        }
        //stats = player.GetComponent<PlayerStats>();
        //stats.Heal(healthGain);

        //RemoveFromInventory();	// Remove the item after use
    }
    // Called when Script is Enabled
    private void OnEnable()
    {
        // Cache Reference to Target
        allConditions = (AllConditions)target;

        // If no Condition where Found
        if (allConditions.conditions == null)
        {
            // Create empty Condition
            allConditions.conditions = new Condition[0];
        }
        // If no ConditionEditors where found
        if (conditionEditors == null)
        {
            // Create the ConditionEditors
            CreateEditors();
        }
    }
示例#24
0
 // Check and React
 public bool CheckAndReact()
 {
     //Go through all Required Conditions
     for (int i = 0; i < requiredConditions.Length; i++)
     {
         // If the Condition is NOT met
         if (!AllConditions.CheckCondition(requiredConditions[i]))
         {
             //Return All Conditions met False
             return(true);
         }
     }
     //If the Condition IS met
     if (reactionCollection)
     {
         reactionCollection.React();
     }
     // Condition Requirement is met
     return(true);
 }
示例#25
0
    public bool VerifyAndExecute()
    {
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            if (!AllConditions.VerifyCondition(requiredConditions[i]))
            {
                return(false);
            }
        }

        if (reactionCollection)
        {
            reactionCollection.React();
        }
        else
        {
            Debug.Log("No ReactionCollection set.");
        }
        return(true);
    }
    /*
     * check the condition accroding to 3 different boolean value
     * if the the condition is checked return true;
     */
    public bool CheckAndReact()
    {
        //check if the condition are satisfied
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            if (!AllConditions.CheckCondition(requiredConditions[i]))
            {
                return(false);
            }
        }

        //if the condition collection is not completed than react
        if (reactionCollection && complete == false)
        {
            reactionCollection.React();
            return(true);
        }

        return(false);
    }
    public ReactionCollection reactionCollection;               // Reference to the ReactionCollection that will React should all the Conditions be met.


    // This is called by the Interactable one at a time for each of its ConditionCollections until one returns true.
    public bool CheckAndReact()
    {
        // Go through all Conditions...
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            // ... and check them against the AllConditions version of the Condition.  If they don't have the same satisfied flag, return false.
            if (!AllConditions.CheckCondition(requiredConditions[i]))
            {
                return(false);
            }
        }

        // If there is an ReactionCollection assigned, call its React function.
        if (reactionCollection)
        {
            reactionCollection.React();
        }

        // A Reaction happened so return true.
        return(true);
    }
    private static void CreateAllConditionsAsset()
    {
        // If AllCondition Found (already Created)
        if (AllConditions.Instance)
        {
            // Do Nothing
            return;
        }

        // Otherwise: Create Instance of AllConditions Object
        AllConditions instance = CreateInstance <AllConditions> ();

        // Make Asset for AllConditions
        AssetDatabase.CreateAsset(instance, creationPath);

        // Set a Singleton Instance
        AllConditions.Instance = instance;

        // Create new EmptyArray of Conditions
        instance.conditions = new Condition[0];
    }
        // This method gets the values of data parameter
        // and assign them to scriptable objects inside the project
        private void setGameState(SerializedStoredData data)
        {
            // Allconditions
            if (AllConditions.Instance != null)
            {
                // Set the conditions to the saved game state
                AllConditions.setConditionsState(data.gameData.conditions);
            }
            else
            {
                Debug.Log("No AllConditions Asset Found inside project resources");
            }

            // Inventory
            if (inventory)
            {
                // Set the inventory
                inventory.setInventoryState(data.gameData.itemsNames);
            }
            else
            {
                Debug.Log("No Inventory found");
            }

            // Data Saves
            for (int i = 0; i < data.gameData.gameSaveDatas.Length; i++)
            {
                int saveDataIndex = allProjectSaveDatas.IndexOf(allProjectSaveDatas.Find(saveData => saveData.name == data.gameData.gameSaveDatas[i].name));

                if (saveDataIndex != -1)
                {
                    allProjectSaveDatas[saveDataIndex] = data.gameData.gameSaveDatas[i];
                }
                else
                {
                    Debug.LogError("Data Save: " + data.gameData.gameSaveDatas[i].name + " found on save data file but not present in all Game Save Datas");
                }
            }
        }
示例#30
0
 public IPayloadProvider Play(Member source, Target target, Group group, Scope scope, int amountPaid)
 {
     if (type == CardBattleActionType.Battle)
     {
         return(new SinglePayload(new ApplyBattleEffect(battleEffect, source, target)));
     }
     if (type == CardBattleActionType.AnimateCharacter)
     {
         return(new SinglePayload(new CharacterAnimationRequested(source.Id, characterAnimation)));
     }
     if (type == CardBattleActionType.AnimateAtTarget)
     {
         return(new SinglePayload(new BattleEffectAnimationRequested {
             EffectName = atTargetAnimation, PerformerId = source.Id, Target = target, Scope = scope, Group = group
         }));
     }
     if (type == CardBattleActionType.Condition)
     {
         return(new DelayedPayload(() => AllConditions.Resolve(conditionData, source, target, group, scope, amountPaid)));
     }
     throw new Exception($"Unrecognized card battle action type: {Enum.GetName(typeof(CardBattleActionType), Type)}");
 }