Esempio n. 1
0
        private bool checkTool(NubiaPlayer from, Item tool)
        {
            if (NubiaInfoRessource.GetRessourceType(Ressource) == NubiaRessourceType.Metal &&
                tool is Pickaxe)
            {
                if (((Pickaxe)tool).UsesRemaining > 0)
                {
                    return(true);
                }
            }
            else if (NubiaInfoRessource.GetRessourceType(Ressource) == NubiaRessourceType.Bois &&
                     tool is BaseAxe)
            {
                if (((BaseAxe)tool).UsesRemaining > 0)
                {
                    return(true);
                }
            }

            from.SendMessage("Votre outil semble inadapté");
            return(false);
        }
Esempio n. 2
0
 public override bool checkRessource(NubiaRessource res)
 {
     return(NubiaInfoRessource.GetRessourceType(res) == NubiaRessourceType.Bois);
 }
Esempio n. 3
0
        private void FinishSpecialHarvest(NubiaPlayer from, Item tool)
        {
            doHarvestEffect(from, tool);

            NubiaInfoRessource infos = NubiaInfoRessource.GetInfoRessource(Ressource);

            CompType comp = CompType.Minage;

            if (NubiaInfoRessource.GetRessourceType(Ressource) == NubiaRessourceType.Bois)
            {
                comp = CompType.Buchage;
            }

            bool check = from.Competences[comp].roll(infos.Diff);

            if (tool is IUsesRemaining)
            {
                IUsesRemaining utool = tool as IUsesRemaining;
                utool.UsesRemaining--;
                if (utool.UsesRemaining <= 0)
                {
                    tool.Consume();
                }
            }

            if (check)
            {
                if (from.Competences[comp].roll(infos.Diff - 5))
                {
                    RessourceConsume();
                    from.SendMessage("Vous exploitez la ressource avec succès");
                    Item special = BaseRessource.getRessource(Ressource);
                    if (special != null)
                    {
                        if (from.Backpack != null)
                        {
                            from.Backpack.AddItem(special);
                        }
                        else
                        {
                            special.MoveToWorld(from.Location, from.Map);
                        }
                    }
                    else
                    {
                        from.SendMessage("BUG: la ressource n'a pas de class correspondante. Contactez l'équipe");
                    }
                }
                else
                {
                    from.SendMessage("Vous n'arrivez pas à extraire la ressource spéciale");

                    Item normal = null;

                    if (NubiaInfoRessource.GetRessourceType(Ressource) == NubiaRessourceType.Bois)
                    {
                        normal = new BoisNormal();
                    }
                    else
                    {
                        normal = new MetalFer();
                    }

                    if (from.Backpack != null)
                    {
                        from.Backpack.AddItem(normal);
                    }
                    else
                    {
                        normal.MoveToWorld(from.Location, from.Map);
                    }
                }
            }
            else
            {
                if (!from.Competences[comp].roll(infos.Diff - 5))
                {
                    RessourceConsume();
                    from.SendMessage("Une partie de la ressource est saccagée");
                    from.Emote("*Saccage*");
                }
                from.SendMessage("Vous n'arrivez pas à exploiter correctement la ressource");
            }
        }