示例#1
0
 public void AddAbility(MonsterAbility ability)
 {
     if (ability.Prepare(this))
     {
         if (slotsUsed + ability.SlotCost() > slots)
         {
             ability.Complain(1);
         }
         else
         {
             //if it's an actual ability, it'll be inserted as a root node
             //otherwise, it'll be inserted as a child node of whatever
             //ability it's modifying
             if (ability.IsBaseAbility())
             {
                 abilities.Add(ability);
             }
             else
             {
                 MonsterAbility parent = ability.GetParent();
                 parent.AddModifier((AbilityModifier)ability);
             }
         }
     }
 }
示例#2
0
 public void registerAbility()
 {
     if (ability == null)
     {
         ability = transform.Find("Attacker").GetComponent <MonsterAbility>();
     }
 }
示例#3
0
        private void addAbilityButton_Click(object sender, EventArgs e)
        {
            AbilitiesForm d = new AbilitiesForm();

            if (d.ShowDialog() == DialogResult.OK)
            {
                Type           abilityType = asm.GetType("Elena." + d.SelectedNode().Name);
                bool           propertyGenerated;
                MonsterAbility ability;
                try
                {
                    ability           = (MonsterAbility)Activator.CreateInstance(abilityType);
                    propertyGenerated = true;
                }
                catch
                {
                    propertyGenerated = false;
                    ability           = new NullAbility();
                }
                if (propertyGenerated)
                {
                    if (selectedAbility.IsNull)
                    {
                        monster.AddAbility(ability);
                    }
                    else
                    {
                        monster.AddAbility(ability, selectedAbility);
                    }
                    selectedAbility = new NullAbility();
                }
                this.UpdateData();
            }
        }
示例#4
0
        public void AddAbility(MonsterAbility ability, MonsterAbility parent)
        {
            bool validToAdd = true;

            if (validToAdd)
            {
                //catch case wherein a modifier is selected
                if (parent.IsBaseAbility() && !ability.IsBaseAbility())
                {
                    ability.SetupParent(parent);
                    if (ability.Prepare(this))
                    {
                        if (slotsUsed + ability.SlotCost() > slots)
                        {
                            ability.Complain(1);
                        }
                        else
                        {
                            parent.AddModifier((AbilityModifier)ability);
                        }
                    }
                }
                else
                {
                    AddAbility(ability);
                }
            }
        }
示例#5
0
        private void abilsList_doubleClick(object sender, EventArgs e)
        {
            MonsterAbility a = FindAbilityInTree(abilsList.SelectedNode, abilsList.SelectedNode.Parent);

            if (a.IsNull != true)
            {
                selectedAbility.Edit(monster);
                this.UpdateData();
            }
        }
 public override List<CardData> CompileCards()
 {
     for (int i = 0; i < abilities.Count; i++){
         for (int k = 0; k < multiplier[i]; k++){
             MonsterAbility ability = CardLibrary.Instance().GetCardData(abilities[i]) as MonsterAbility;
             ability = new MonsterAbility(ability);
             Inventory.Add(ability);
         }
     }
     return Inventory;
 }
示例#7
0
    public override void ChildInit()
    {
        m_Bodybounds.center = m_Pivot.position;

        m_OriginMaterial    = m_Skin.material;
        m_Seebounds.center  = m_Pivot.position;
        m_Seebounds.extents = new Vector3(2.5f, 2.5f, 2.5f);
        m_MonsterAbility    = GetComponent <MonsterAbility>();
        m_MonsterAbility.Init();

        m_MonsterAbility.SetHp(m_MonsterAbility.m_AllHp);
    }
示例#8
0
        private void abilsList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            MonsterAbility a = FindAbilityInTree(abilsList.SelectedNode, abilsList.SelectedNode.Parent);

            if (a.IsNull != true)
            {
                selectedAbility        = a;
                editAbilButton.Enabled = selectedAbility.IsEditable();
            }
            else
            {
                selectedAbility        = new NullAbility();
                editAbilButton.Enabled = false;
            }
        }
示例#9
0
 private void delAbilButton_Click(object sender, EventArgs e)
 {
     if (!selectedAbility.IsNull)
     {
         if (selectedAbility.IsBaseAbility())
         {
             monster.Abilities.Remove(selectedAbility);
         }
         else
         {
             monster.RemoveModifier((AbilityModifier)selectedAbility);
         }
         selectedAbility = new NullAbility();
         this.UpdateData();
     }
 }
示例#10
0
 public MonsterAbility(MonsterAbility data)
 {
     title = data.title;
     type = data.type;
     stats = data.stats;
     desc = data.desc;
     flavour = data.flavour;
     flines = data.flines;
     level = data.level;
     cardpower = data.cardpower;
     bannerframe = data.bannerframe;
     image = data.image;
     back = data.back;
     front = data.front;
     power = data.power;
     cooldown = data.cooldown;
     speed = data.speed;
     id = data.id;
     powerScale = data.powerScale;
     perLevel = data.perLevel;
     picture = data.picture;
 }
示例#11
0
 // Use this for initialization
 void Start()
 {
     mis   = GameObject.FindGameObjectWithTag("Mission").GetComponent <MissionProgress>();
     mons  = GameObject.FindGameObjectWithTag("Rhino").GetComponent <MonsterAbility>();
     spawn = GameObject.FindGameObjectWithTag("MissionRhinoSpawn");
 }
示例#12
0
 // Use this for initialization
 void Start()
 {
     boss  = GameObject.FindGameObjectWithTag("BOSS").GetComponent <MonsterAbility>();
     blood = GetComponent <Slider>();
 }
示例#13
0
 float AttackSkill2(MonsterAbility ma)
 {
     return(ma.health -= 100.0f);
 }
示例#14
0
 // Use this for initialization
 void Start()
 {
     insect = GetComponent <MonsterAbility>();
     mis    = GameObject.FindGameObjectWithTag("Mission").GetComponent <MissionProgress>();
 }
示例#15
0
    // Use this for initialization
    void Start()
    {
        foreach(Texture texture in back_textures){
            var mat = new Material(front_border);
            mat.mainTexture = texture;
            back_materials.Add (mat);
        }
        var card_object = (GameObject)GameObject.Instantiate(card_prefab);
        var dict = Json.Deserialize(card_text_data.text) as Dictionary<string,object>;
        foreach(var dict_pair in dict){
            var deck_name = (string)dict_pair.Key;
            decks_[deck_name] = new List<int>();
            var deck_list = decks_[deck_name];
            var card_list = (List<object>)dict_pair.Value;
            foreach(var card in card_list){
                var card_dict = (Dictionary<string, object>)card;
                CardData card_data = new CardData();

                if(deck_name == "Monsters")
                    card_data = new Monster();

                if(deck_name == "Items")
                    card_data = new Item();

                if(deck_name == "Players")
                    card_data = new Player();

                if(deck_name == "Weapons")
                    card_data = new Weapon();

                if(deck_name == "MonsterAbilities")
                    card_data = new MonsterAbility();

                // No special behaviour right now //
                if(deck_name == "Reload"){

                }

                var current_class = card_data.GetType();

                card_data.title = "Title";
                if(card_dict.ContainsKey("Title")){
                    card_data.title = (string)card_dict["Title"];
                }
                card_data.type = "Type";
                if(card_dict.ContainsKey("Type")){
                    card_data.type = (string)card_dict["Type"];
                }
                card_data.stats = "Stats";
                if(card_dict.ContainsKey("Stats")){
                    card_data.stats = (string)card_dict["Stats"];
                }
                card_data.desc = "Desc";
                if(card_dict.ContainsKey("Desc")){
                    card_data.desc = (string)card_dict["Desc"];
                }
                card_data.flavour = "Flavour";
                if(card_dict.ContainsKey("Flavour")){
                    card_data.flavour = (string)card_dict["Flavour"];
                }
                card_data.cardpower = 0;
                if(card_dict.ContainsKey("CardPower")){
                    card_data.cardpower = (int)(long)card_dict["CardPower"];
                }
                card_data.bannerframe = 0;
                if(card_dict.ContainsKey("BannerAndFrame")){
                    card_data.bannerframe = (int)(long)card_dict["BannerAndFrame"];
                }
                card_data.level = 0;
                if(card_dict.ContainsKey("Level")){
                    card_data.level = (int)(long)card_dict["Level"];
                }
                card_data.flines = 0;
                if(card_dict.ContainsKey("FlavourLines")){
                    card_data.flines = (int)(long)card_dict["FlavourLines"];
                }
                card_data.image = 0;
                if (current_class != typeof(MonsterAbility)){
                    if(card_dict.ContainsKey("Image")){
                        card_data.image = (int)(long)card_dict["Image"];
                    }
                }
                card_data.back = 0;
                if(card_dict.ContainsKey("Back")){
                    card_data.back = (int)(long)card_dict["Back"];
                }
                card_data.front = 0;
                if(card_dict.ContainsKey("Front")){
                    card_data.front = (int)(long)card_dict["Front"];
                }

                // If it's a Monster //
                if(current_class == typeof(Monster)){
                    Monster monster_data = (Monster) card_data;

                    // Battle Stats //
                    monster_data.max_health = 0;
                    if(card_dict.ContainsKey("BaseHealth")){
                        monster_data.max_health = (int)(long)card_dict["BaseHealth"];
                        monster_data.current_health = (int)(long)card_dict["BaseHealth"];
                    }
                    monster_data.faith = 0;
                    if(card_dict.ContainsKey("Faith")){
                        monster_data.faith = (int)(long)card_dict["Faith"];
                    }
                    monster_data.spirit = 0;
                    if(card_dict.ContainsKey("Spirit")){
                        monster_data.spirit = (int)(long)card_dict["Spirit"];
                    }
                    monster_data.strength = 0;
                    if(card_dict.ContainsKey("Strength")){
                        monster_data.strength = (int)(long)card_dict["Strength"];
                    }
                    monster_data.defense = 0;
                    if(card_dict.ContainsKey("Defense")){
                        monster_data.defense = (int)(long)card_dict["Defense"];
                    }
                    monster_data.dexterity = 0;
                    if(card_dict.ContainsKey("Dexterity")){
                        monster_data.dexterity = (int)(long)card_dict["Dexterity"];
                    }

                    // Scale Stats //
                    monster_data.health_scale = 0;
                    if(card_dict.ContainsKey("hScale")){
                        monster_data.health_scale = (int)(long)card_dict["hScale"];
                    }
                    monster_data.faith_scale = 0;
                    if(card_dict.ContainsKey("fScale")){
                        monster_data.faith_scale = (int)(long)card_dict["fScale"];
                    }
                    monster_data.spirit_scale = 0;
                    if(card_dict.ContainsKey("spScale")){
                        monster_data.spirit_scale = (int)(long)card_dict["spScale"];
                    }
                    monster_data.strength_scale = 0;
                    if(card_dict.ContainsKey("strScale")){
                        monster_data.strength_scale = (int)(long)card_dict["strScale"];
                    }
                    monster_data.defense_scale = 0;
                    if(card_dict.ContainsKey("defScale")){
                        monster_data.defense_scale = (int)(long)card_dict["defScale"];
                    }

                    // Level Stats //
                    monster_data.level = 0;
                    if(card_dict.ContainsKey("Level")){
                        monster_data.level = (int)(long)card_dict["Level"];
                    }

                    // Picture //
                    card_data.picture = card_object.GetComponent<BakeScript>().monster_textures[card_data.image];
                }

                // If it's a Player //
                if(current_class == typeof(Player)){
                    Player player_data = (Player) card_data;

                    // Battle Stats //
                    player_data.max_health = 0;
                    if(card_dict.ContainsKey("BaseHealth")){
                        player_data.max_health = (int)(long)card_dict["BaseHealth"];
                        player_data.current_health = (int)(long)card_dict["BaseHealth"];
                    }
                    player_data.faith = 0;
                    if(card_dict.ContainsKey("Faith")){
                        player_data.faith = (int)(long)card_dict["Faith"];
                    }
                    player_data.spirit = 0;
                    if(card_dict.ContainsKey("Spirit")){
                        player_data.spirit = (int)(long)card_dict["Spirit"];
                    }
                    player_data.strength = 0;
                    if(card_dict.ContainsKey("Strength")){
                        player_data.strength = (int)(long)card_dict["Strength"];
                    }
                    player_data.defense = 0;
                    if(card_dict.ContainsKey("Defense")){
                        player_data.defense = (int)(long)card_dict["Defense"];
                    }
                    player_data.dexterity = 0f;
                    if(card_dict.ContainsKey("Dexterity")){
                        player_data.dexterity = (float)(long)card_dict["Dexterity"];
                    }

                    // Scale Stats //
                    player_data.health_scale = 0;
                    if(card_dict.ContainsKey("hScale")){
                        player_data.health_scale = (int)(long)card_dict["hScale"];
                    }
                    player_data.faith_scale = 0;
                    if(card_dict.ContainsKey("fScale")){
                        player_data.faith_scale = (int)(long)card_dict["fScale"];
                    }
                    player_data.spirit_scale = 0;
                    if(card_dict.ContainsKey("spScale")){
                        player_data.spirit_scale = (int)(long)card_dict["spScale"];
                    }
                    player_data.strength_scale = 0;
                    if(card_dict.ContainsKey("strScale")){
                        player_data.strength_scale = (int)(long)card_dict["strScale"];
                    }
                    player_data.defense_scale = 0;
                    if(card_dict.ContainsKey("defScale")){
                        player_data.defense_scale = (int)(long)card_dict["defScale"];
                    }
                    player_data.dexterity_scale = 0f;
                    if(card_dict.ContainsKey("dexScale")){
                        player_data.dexterity_scale = (float)(double)card_dict["dexScale"];
                    }

                    // Level Stats //
                    player_data.level = 0;
                    if(card_dict.ContainsKey("Level")){
                        player_data.level = (int)(long)card_dict["Level"];
                    }
                    player_data.current_experience = 0;
                    if(card_dict.ContainsKey("Exp")){
                        player_data.current_experience = (int)(long)card_dict["Exp"];
                    }
                    player_data.next_level_at = 0;
                    if(card_dict.ContainsKey("nextLevel")){
                        player_data.next_level_at = (int)(long)card_dict["nextLevel"];
                    }
                    player_data.experience_scale = 0;
                    if(card_dict.ContainsKey("expScale")){
                        player_data.experience_scale = (int)(long)card_dict["expScale"];
                    }
                }

                // If it's an Weapon //

                if(current_class == typeof(Weapon)){
                    Weapon weapon_data = (Weapon) card_data;

                    weapon_data.power = 0;
                    if(card_dict.ContainsKey("Power")){
                        weapon_data.power = (int)(long)card_dict["Power"];
                    }
                    weapon_data.speed = 2;
                    weapon_data.cooldown = 0;

                    weapon_data.powerScale = 0;
                    if(card_dict.ContainsKey("pScale")){
                        weapon_data.powerScale = (int)(long)card_dict["pScale"];
                    }
                    weapon_data.perLevel = 0;
                    if(card_dict.ContainsKey("pLevel")){
                        weapon_data.perLevel = (int)(long)card_dict["pLevel"];
                    }

                }

                // If it's a monster ability //

                if(current_class == typeof(MonsterAbility)){
                    MonsterAbility ability = (MonsterAbility) card_data;

                    ability.power = 0;
                    if(card_dict.ContainsKey("Power")){
                        ability.power = (int)(long)card_dict["Power"];
                    }
                    ability.speed = 0f;
                    if(card_dict.ContainsKey("Speed")){
                        ability.speed = (float)(double)card_dict["Speed"];
                    }
                    ability.cooldown = 0;

                }

                // If it's an Item //

                // *************** //

                card_data.id = id;
                id += 1;

                deck_list.Add(cards_.Count);
                //card_object.GetComponent<BakeScript>().SetCardData(card_data);
                //if(current_class != typeof(MonsterAbility))
                    //card_data.material = card_object.GetComponent<BakeScript>().Bake();
                //card_data.picture = card_object.GetComponent<BakeScript>().monster_textures[card_data.image];
                cards_.Add(card_data);
            }
        }
        GameObject.Destroy(card_object);
    }