Inheritance: MonoBehaviour
Example #1
0
	void attack ()
	{
		// Iterate through NPCs, select those within attack distance, attack is attack speed has refreshed
		Mob[] attackableTargets = FindObjectsOfType (typeof(Mob)) as Mob[];
		foreach (Mob attackable_target in attackableTargets) {
			if (Vector3.Distance (attackable_target.transform.position, transform.position) < attack_distance) {
				//Debug.Log ("Mob within range");
				target = attackable_target;
				
				if (last_attack_time + attack_speed < Time.time) {
					m_buildingSound.PlayAttackSound ();
					// Instantiate a bullet, then assign the target to it.
					Bullet bullet_instance = Instantiate (bullet_prefab, transform.position, transform.rotation) as Bullet;
					
					bullet_instance.SetTarget (target.gameObject);
					
					bullet_instance.easeStyle = Bullet.EaseStyle.EXPONENTIAL;
		
					attackable_target.takeDamage (attack_damage);
					
					last_attack_time = Time.time;
				}
			}
		} 
	}
Example #2
0
    public override void UnityFixedUpdate () {
        //motion
        if (targetMob == null)
        {
            box.velocity = walkSpeed * team.direction;
            animator.SetBool("isAttacking", false);
        }
        else
        {
            box.velocity = 0;
            animator.SetBool("isAttacking", true);
        }
        //update collision box
        box.FixedUpdate();
        //adjust sprite transform
        transform.position = new Vector3(box.x + (box.width / 2), y, -y / 1000);
        transform.localScale = new Vector3(xScale * team.direction, (1 - squish) * xScale, 1);
        //attack
        if (attackTimer > 0) {
            attackTimer -= Time.fixedDeltaTime;
        } else {
            attackTimer = 0;
        }

        if (targetMob != null) {
            if (attackTimer == 0) {
                attackTimer = attackSpeed;
                targetMob.hitPoints -= attackPower;
                if (targetMob.hitPoints <= 0) {
                    targetMob = null;
                }
            }
        }
    }
Example #3
0
    public Projectile(Mob mob)
        : base("bullet.png")
    {
        Damage = mob.AttackPower;
        Owner = mob;
        Alive = true;
        Facing = mob.Facing;
        MoveSpeed = 5;

        // make bullet come from correct place of sprite
        switch(Facing)
        {
        case Direction.N:
            this.x = mob.x + (mob.width / 2);
            this.y = mob.y + mob.height;
            break;
        case Direction.S:
            this.x = mob.x + (mob.width / 2);
            this.y = mob.y;
            break;
        case Direction.W:
            this.x = mob.x;
            this.y = mob.y + (mob.height / 2);
            break;
        case Direction.E:
            this.x = mob.x + mob.width;
            this.y = mob.y + (mob.height / 2);
            break;
        }

        Box = new Rect(this.x - (this.width / 2), this.y - (this.height / 2), this.width, this.height);
    }
Example #4
0
    protected override void allyInteraction(Mob ally)
    {
        if (ally.target == null)
        {
            Vector2 rayDirection = ally.transform.position - transform.position;

            if (Vector2.Angle(rayDirection, transform.up) <= fieldOfView / 2)
            {
                RaycastHit2D hit = Physics2D.Raycast(transform.position, rayDirection, visionRange);

                if (hit != null && hit.collider != null)
                {
                    transform.up = hit.normal;
                    float turn = Random.Range(-rotationRange, rotationRange);
                    transform.Rotate(0f, 0f, turn);
                }
            }
        }
        else
        {
            if (Vector2.Distance(transform.position, ally.target.transform.position) <= visionRange * 2)
            {
                setTarget(ally.target);
            }
        }
    }
Example #5
0
 void OnTriggerExit2D(Collider2D other)
 {
     if(other.gameObject == lastTarget.gameObject)
     {
         lastTarget = null;
         hasTarget = false;
     }
 }
Example #6
0
    void Awake()
    {
        _me = gameObject.GetComponent<Mob>();

        if (_me == null)
            Debug.Log("NULL - +");

        Debug.Log( _me.meleeResetTimer + "!!!!!!!!" );
    }
 private void Awake()
 {
     // Setting up references.
     m_GroundCheck = transform.Find("GroundCheck");
     m_CeilingCheck = transform.Find("CeilingCheck");
     m_Anim = GetComponent<Animator>();
     m_Rigidbody2D = GetComponent<Rigidbody2D>();
     mob=GetComponent<Mob>();
 }
Example #8
0
    protected override void enemyInteraction(Mob enemy)
    {
        setTarget(enemy);

        if (enemy.target == null)
        {
            enemy.setTarget(this);
        }
    }
Example #9
0
 // mobs hit each other (apply damage to hitpoints)
 private void ApplyDamage(Mob m1, Mob m2)
 {
     m1.health -= m2.damage;
     m1.hasAttacked = true;
     if (!m2.hasAttacked)
     {
         m2.health -= m1.damage;
         m2.hasAttacked = true;
     }
 }
Example #10
0
 void Update()
 {
     if (player.opponent != null) {
                     target = player.opponent.GetComponent<Mob> ();
                     healthPercentage = (float)target.health / (float)target.maxHealth;
             } else {
         target = null;
         healthPercentage = 0;
             }
 }
 void Start()
 {
     //gameObject.GetComponent<Looting>().Populate(2, Crafting.ItemName.FoxFur);
     if (_mob == null)
     {
         Debug.Log("Set mob");
         _mob = Mob.getMob(mobName);
         _mob.Alive = false;
     }
 }
Example #12
0
        public override bool Action(Mob user, string text)
        {
            if (!SetTargetAllyAsFirstArg(user, text))
                return false;

            user.WaitPulses += Global.RoundDuration;
            Combat.OneHeal(user, user.TargetAlly, this);

            return true;
        }
    void Start()
    {
        waypoints = GetWaypoints();
        waypointNum = waypoints.Length;
        currentWaypoint = 0;

        mob = GetComponent<Mob>();

        transform.position = waypoints[currentWaypoint].transform.position;
    }
Example #14
0
    protected override void enemyInteraction(Mob enemy)
    {
        // Set this mob's target to be the detected enemy
        setTarget(enemy);

        // Prevents the enemy from wandering aimlessly while being shot
        if (enemy.target == null)
        {
            enemy.setTarget(this);
        }
    }
Example #15
0
    void OnTriggerStay2D(Collider2D other)
    {
        if(lastTarget != null)
            return;
        if(other.CompareTag("Mob"))
        {

            lastTarget = other.GetComponent<Mob>();
            hasTarget = true;
        }
    }
Example #16
0
 public void DespawnMob(Mob _mob) {
    
     GameObjectPool pool;
     if (_mob.mobTemplate == 0) {
         pool = mobPool1;
     }
     else {
         pool = mobPool2;
     }
     _mob.OnDespawn();
     pool.Return(_mob.gameObject);
 }
Example #17
0
 public Bullet(Mob.Mob newTarget, Tower tower)
 {
     this._dmg = 20;
     this._speed = 2;
     this._game = tower.getGame();
     this._coord.X = tower.getPosition().X * tower.getGame().size_case;
     this._coord.Y = tower.getPosition().Y * tower.getGame().size_case;
     this._target = new List<Mob.Mob>();
     this._target.Add(newTarget);
     this._area = 0;
     this.loopLifeMax = 200;
 }
Example #18
0
 public virtual bool CanAttackPlayer(Mob player)
 {
     if (attackDelay <= 0 && CanAttack && getDistanceToPlayer(player) < attackDistance)
     {
         attackDelay = attackDelayTime;
         return true;
     }
     else
     {
         attackDelay--;
         return false;
     }
 }
Example #19
0
	// Use this for initialization
	void Awake () {
		player = GameObject.FindGameObjectWithTag("player").transform;
<<<<<<< HEAD
		enemyAnimationScript = GetComponentInChildren<EnemyAnimationControl>() as EnemyAnimationControl;
		enemyMoveBaseScript = gameObject.GetComponent<EnemyMoveBase>() as EnemyMoveBase;
		mob = gameObject.GetComponent<Mob>();
=======
		enemyAnimationScript = (EnemyAnimationControl)this.transform.FindChild(modelName).GetComponent<EnemyAnimationControl>();
        mob = gameObject.AddComponent<Mob>();
        mob.Init(CombatUtility.GenNextMobID());
        SceneMng.instance.AddSceneObj(mob);
>>>>>>> parent of cde666f... 怪物受精
	}
Example #20
0
    // Use this for initialization
    public ServerMobs()
    {
        functionName = "Mobs";
        // Database tables name
        tableName = "mob_templates";
        functionTitle = "Mobs Configuration";
        loadButtonLabel = "Load Mobs";
        notLoadedText = "No Mob loaded.";
        // Init
        dataRegister = new Dictionary<int, Mob> ();

        editingDisplay = new Mob ();
        originalDisplay = new Mob ();
    }
Example #21
0
 public Mob(Mob mob)
     : base(mob)
 {
     this.spawnProbability = mob.spawnProbability;
     this.smart = mob.smart;
     this.damage = mob.damage;
     this.visionFocus = mob.visionFocus;
     this.visionFleeing = mob.visionFleeing;
     this.walkSpeed = mob.walkSpeed;
     this.runSpeed = mob.runSpeed;
     this.attackSpeed = mob.attackSpeed;
     this.rangeAttack = mob.rangeAttack;
     this.dropConfigs = mob.dropConfigs;
     this.biomes = mob.biomes;
 }
Example #22
0
    // Gunmen will heal hurt allies that do not have a target
    protected override void allyInteraction(Mob ally)
    {
        // The ally is roaming and has no target
        if (ally.target == null)
        {
            // Heal the ally if injured
            if (ally.CurrentHealth < ally.MaxHealth)
            {
                setTarget(ally);
                ally.setTarget(this);
            }
            // Turn away from the ally if it is at full health
            else
            {
                // Get the ally's direction
                Vector2 rayDirection = ally.transform.position - transform.position;

                // Check to see if the ally is within the field of view
                if (Vector2.Angle(rayDirection, transform.up) <= fieldOfView / 2)
                {
                    // Fire a ray towards the ally
                    RaycastHit2D hit = Physics2D.Raycast(transform.position, rayDirection, visionRange);

                    // Turn away from the ally if there is a collision
                    if (hit != null && hit.collider != null)
                    {
                        transform.up = hit.normal;
                        float turn = Random.Range(-rotationRange, rotationRange);
                        transform.Rotate(0f, 0f, turn);
                    }
                }
            }
        }
        // Help the ally that is fighting an enemy
        else
        {
            // Checks how far the enemy is from this mob to prevent allies
            // from chain detecting a mob from across the map
            if (Vector2.Distance(transform.position, ally.target.transform.position) <= visionRange * 2
                && ally.target.tag != tag)
            {
                setTarget(ally.target);
            }
        }
    }
Example #23
0
    public void SpawnMob(MobDatablock mobDatablock)
    {
        if(spawnedMob)
            Destroy(spawnedMob.gameObject);

        var mobModel = Instantiate(mobDatablock.model) as GameObject;

        mobModel.GetComponent<Renderer>().material.color = mobDatablock.modelColor;

        spawnedMob = mobModel.GetComponent<Mob>();
        spawnedMob.datablock = mobDatablock;
        spawnedMob.demoUI = this;

        mobModel.transform.SetParent(spawnPoint);
        mobModel.transform.localPosition = Vector3.zero;

        CloseLootWindow();
    }
Example #24
0
    // Update is called once per frame
    void Update()
    {
        if(attackTimer >0)
            attackTimer -= Time.deltaTime;

        if(attackTimer < 0)
            attackTimer = 0;

        if(Input.GetKeyDown(KeyCode.F)){
            target = se.EnemigoSeleccionado();
            if (target) {
                if(attackTimer == 0){
                    BasicAttackTarget();
                }
            }
            else
            {
                //debes seleccionar un Objetivo;
            }

        }
    }
Example #25
0
 void Start()
 {
     wherePlayer = AttackDirection.None;
     currentAttackCooldown = attackRate;
     gameController = GameObject.Find("Main Camera").GetComponent<GameController>();
     mob = gameController.mob;
     foreach (Mob m in mob)
     {
         if (m.mobBody == this.gameObject)
             thisMob = m;
         else
         {
             thisMob = new Mob();
             thisMob.isPirate = true;
             thisMob.mobBody = this.gameObject;
         }
     }
     //Debug.Log(thisMob +" "+ mob.IndexOf(thisMob) + " " + thisMob.isPirate);
     player = GameObject.Find("Player");
     rb2d = this.GetComponent<Rigidbody2D>();
     mobAnimator = this.GetComponent<Animator>();
     thisTransform = transform;
 }
Example #26
0
    // Update is called once per frame
    void Update()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Fighter>();

        if(player.opponent != null)
        {
            enemy = player.opponent.GetComponent<Mob>();
            healthBar.fillAmount = Mathf.Lerp (healthBar.fillAmount, (float)enemy.health / (float)enemy.maxHealth, 1.0f);

            player.opponent.GetComponent<Mob>();
            enemyHealthNumbers.GetComponent<Text>().text = enemy.health.ToString() + "/" + enemy.maxHealth.ToString();

        }
        else
        {
            enemy = null;
            healthBar.fillAmount = 0;
        }

        //healthBar.fillAmount = Mathf.Lerp (healthBar.fillAmount, (float)enemy.health / (float)enemy.maxHealth, 0.05f);

        //healthBar.fillAmount = Mathf.Lerp (healthBar.fillAmount, (float)player.opponent.GetComponent<Mob>().health / (float)player.opponent.GetComponent<Mob>().maxHealth, 0.05f);
    }
Example #27
0
    public void OnKillMob(Mob mob)
    {
        SpawnItemBox(mob.RefDropItems, mob.transform.position);

        if (mob.Boss)
        {
            if (Warehouse.Instance.GameTutorial.m_unlockedFollowerTab == true)
            {
                ItemObject petObj = Warehouse.Instance.FindItem(Const.FollowerPetRefItemId);
                if (petObj.Item.Lock == true)
                {
                    petObj.Item.Lock = false;
                    petObj.Item.Level = 1;
                    petObj.Item.Equip(m_champ);

                    Const.GetWindowGui(Const.WindowGUIType.FoundItemGUI).GetComponent<FoundItemGUI>().SetItemObj(petObj);
                    Const.GetWindowGui(Const.WindowGUIType.FoundItemGUI).SetActive(true);
                }

            }

            SpawnItemBox(GetCurrentWave().itemSpawn.bossDefaultItem, mob.transform.position);
            TimeEffector.Instance.BulletTime(0.005f);

        }

        if (true == mob.CheckOnDeath)
        {
            m_mobsOfCheckOnDeath--;
        }

        if (m_champ)
        {
            ++Warehouse.Instance.AlienEssence.Item.Count;
            ++Warehouse.Instance.NewGameStats.KilledMobs;
        }
    }
Example #28
0
 public PanicBehavior(Mob entity, int duration, double speed, double speedMultiplier) : base(entity, duration, speed, speedMultiplier)
 {
     _entity = entity;
 }
Example #29
0
        // Function from file: photocopier.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            int?i = null;
            Obj_Item_Weapon_Paper c = null;
            dynamic copied          = null;
            int?    i2 = null;
            Obj_Item_Weapon_Photo p = null;
            Icon I                   = null;
            Icon img                 = null;
            int? i3                  = null;
            Icon temp_img            = null;
            Obj_Item_Weapon_Photo p2 = null;
            Icon    small_img        = null;
            Icon    ic               = null;
            ByTable nametemp         = null;
            dynamic find             = null;
            Picture selection        = null;
            Mob     tempAI           = null;
            Picture t                = null;
            Obj_Item_Weapon_Photo p3 = null;
            Picture q                = null;
            dynamic I2               = null;
            dynamic img2             = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["copy"]))
            {
                if (Lang13.Bool(this.copy))
                {
                    i = null;
                    i = 0;

                    while ((i ?? 0) < (this.copies ?? 0))
                    {
                        if (this.toner > 0 && !this.busy && Lang13.Bool(this.copy))
                        {
                            c = new Obj_Item_Weapon_Paper(this.loc);

                            if (Lang13.Length(this.copy.info) > 0)
                            {
                                if (this.toner > 10)
                                {
                                    c.info = "<font color = #101010>";
                                }
                                else
                                {
                                    c.info = "<font color = #808080>";
                                }
                                copied   = this.copy.info;
                                copied   = GlobalFuncs.replacetext(copied, "<font face=\"" + "Verdana" + "\" color=", "<font face=\"" + "Verdana" + "\" nocolor=");
                                copied   = GlobalFuncs.replacetext(copied, "<font face=\"" + "Comic Sans MS" + "\" color=", "<font face=\"" + "Comic Sans MS" + "\" nocolor=");
                                c.info  += copied;
                                c.info  += "</font>";
                                c.name   = this.copy.name;
                                c.fields = Lang13.DoubleNullable(this.copy.fields);
                                c.updateinfolinks();
                                this.toner--;
                            }
                            this.busy = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i++;
                    }
                    this.updateUsrDialog();
                }
                else if (Lang13.Bool(this.photocopy))
                {
                    i2 = null;
                    i2 = 0;

                    while ((i2 ?? 0) < (this.copies ?? 0))
                    {
                        if (this.toner >= 5 && !this.busy && Lang13.Bool(this.photocopy))
                        {
                            p   = new Obj_Item_Weapon_Photo(this.loc);
                            I   = new Icon(this.photocopy.icon, this.photocopy.icon_state);
                            img = new Icon(this.photocopy.img);

                            if (this.greytoggle == "Greyscale")
                            {
                                if (this.toner > 10)
                                {
                                    I.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#000000");
                                    img.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#000000");
                                }
                                else
                                {
                                    I.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#646464");
                                    img.MapColors("#4d4d4d", "#969696", "#1c1c1c", "#646464");
                                }
                                this.toner -= 5;
                            }
                            else if (this.greytoggle == "Color")
                            {
                                if (this.toner >= 10)
                                {
                                    this.toner -= 10;
                                }
                                else
                                {
                                    i2++;
                                    continue;
                                }
                            }
                            p.icon       = I;
                            p.img        = img;
                            p.name       = this.photocopy.name;
                            p.desc       = this.photocopy.desc;
                            p.scribble   = this.photocopy.scribble;
                            p.pixel_x    = Rand13.Int(-10, 10);
                            p.pixel_y    = Rand13.Int(-10, 10);
                            p.blueprints = Lang13.Bool(this.photocopy.blueprints);
                            this.busy    = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i2++;
                    }
                }
                else if (this.ass != null)
                {
                    i3 = null;
                    i3 = 0;

                    while ((i3 ?? 0) < (this.copies ?? 0))
                    {
                        temp_img = null;

                        if (this.ass is Mob_Living_Carbon_Human && (Lang13.Bool(((Mob)this.ass).get_item_by_slot(14)) || Lang13.Bool(((Mob)this.ass).get_item_by_slot(13))))
                        {
                            Task13.User.WriteMsg("<span class='notice'>You feel kind of silly, copying " + (this.ass == Task13.User ? ((dynamic)("your")) : ((dynamic)(this.ass))) + (this.ass == Task13.User ? "" : "'s") + " ass with " + (this.ass == Task13.User ? "your" : "their") + " clothes on.</span>");
                            break;
                        }
                        else if (this.toner >= 5 && !this.busy && this.check_ass())
                        {
                            if (this.ass is Mob_Living_Carbon_Alien_Humanoid || this.ass is Mob_Living_SimpleAnimal_Hostile_Alien)
                            {
                                temp_img = new Icon("icons/ass/assalien.png");
                            }
                            else if (this.ass is Mob_Living_Carbon_Human)
                            {
                                if (this.ass.gender == GlobalVars.MALE)
                                {
                                    temp_img = new Icon("icons/ass/assmale.png");
                                }
                                else if (this.ass.gender == GlobalVars.FEMALE)
                                {
                                    temp_img = new Icon("icons/ass/assfemale.png");
                                }
                                else
                                {
                                    temp_img = new Icon("icons/ass/assmale.png");
                                }
                            }
                            else if (this.ass is Mob_Living_SimpleAnimal_Drone || this.ass is Mob_Living_SimpleAnimal_Drone)
                            {
                                temp_img = new Icon("icons/ass/assdrone.png");
                            }
                            else
                            {
                                break;
                            }
                            p2         = new Obj_Item_Weapon_Photo(this.loc);
                            p2.desc    = "You see " + this.ass + "'s ass on the photo.";
                            p2.pixel_x = Rand13.Int(-10, 10);
                            p2.pixel_y = Rand13.Int(-10, 10);
                            p2.img     = temp_img;
                            small_img  = new Icon(temp_img);
                            ic         = new Icon("icons/obj/items.dmi", "photo");
                            small_img.Scale(8, 8);
                            ic.Blend(small_img, 3, 10, 13);
                            p2.icon     = ic;
                            this.toner -= 5;
                            this.busy   = true;
                            Task13.Sleep(15);
                            this.busy = false;
                        }
                        else
                        {
                            break;
                        }
                        i3++;
                    }
                }
                this.updateUsrDialog();
            }
            else if (Lang13.Bool(href_list["remove"]))
            {
                if (Lang13.Bool(this.copy))
                {
                    if (!(Task13.User is Mob_Living_Silicon_Ai))
                    {
                        this.copy.loc = Task13.User.loc;
                        Task13.User.put_in_hands(this.copy);
                    }
                    else
                    {
                        this.copy.loc = this.loc;
                    }
                    Task13.User.WriteMsg("<span class='notice'>You take " + this.copy + " out of " + this + ".</span>");
                    this.copy = null;
                    this.updateUsrDialog();
                }
                else if (Lang13.Bool(this.photocopy))
                {
                    if (!(Task13.User is Mob_Living_Silicon_Ai))
                    {
                        this.photocopy.loc = Task13.User.loc;
                        Task13.User.put_in_hands(this.photocopy);
                    }
                    else
                    {
                        this.photocopy.loc = this.loc;
                    }
                    Task13.User.WriteMsg("<span class='notice'>You take " + this.photocopy + " out of " + this + ".</span>");
                    this.photocopy = null;
                    this.updateUsrDialog();
                }
                else if (this.check_ass())
                {
                    ((dynamic)this.ass).WriteMsg("<span class='notice'>You feel a slight pressure on your ass.</span>");
                }
            }
            else if (Lang13.Bool(href_list["min"]))
            {
                if ((this.copies ?? 0) > 1)
                {
                    this.copies--;
                    this.updateUsrDialog();
                }
            }
            else if (Lang13.Bool(href_list["add"]))
            {
                if ((this.copies ?? 0) < (this.maxcopies ?? 0))
                {
                    this.copies++;
                    this.updateUsrDialog();
                }
            }
            else if (Lang13.Bool(href_list["aipic"]))
            {
                if (!(Task13.User is Mob_Living_Silicon_Ai))
                {
                    return(null);
                }

                if (this.toner >= 5 && !this.busy)
                {
                    nametemp  = new ByTable();
                    find      = null;
                    selection = null;
                    tempAI    = Task13.User;

                    if (((dynamic)tempAI).aicamera.aipictures.len == 0)
                    {
                        Task13.User.WriteMsg("<span class='boldannounce'>No images saved</span>");
                        return(null);
                    }

                    foreach (dynamic _a in Lang13.Enumerate(((dynamic)tempAI).aicamera.aipictures, typeof(Picture)))
                    {
                        t = _a;

                        nametemp.Add(t.fields["name"]);
                    }
                    find = Interface13.Input("Select image (numbered in order taken)", null, null, null, nametemp, InputType.Any);
                    p3   = new Obj_Item_Weapon_Photo(this.loc);

                    foreach (dynamic _b in Lang13.Enumerate(((dynamic)tempAI).aicamera.aipictures, typeof(Picture)))
                    {
                        q = _b;


                        if (q.fields["name"] == find)
                        {
                            selection = q;
                            break;
                        }
                    }
                    I2            = selection.fields["icon"];
                    img2          = selection.fields["img"];
                    p3.icon       = I2;
                    p3.img        = img2;
                    p3.desc       = selection.fields["desc"];
                    p3.blueprints = Lang13.Bool(selection.fields["blueprints"]);
                    p3.pixel_x    = Rand13.Int(-10, 10);
                    p3.pixel_y    = Rand13.Int(-10, 10);
                    this.toner   -= 5;
                    this.busy     = true;
                    Task13.Sleep(15);
                    this.busy = false;
                }
                this.updateUsrDialog();
            }
            else if (Lang13.Bool(href_list["colortoggle"]))
            {
                if (this.greytoggle == "Greyscale")
                {
                    this.greytoggle = "Color";
                }
                else
                {
                    this.greytoggle = "Greyscale";
                }
                this.updateUsrDialog();
            }
            return(null);
        }
Example #30
0
    public override void EndBehavior(Mob mob)
    {
        base.EndBehavior(mob);

        Destroy(mob.gameObject);
    }
Example #31
0
 // Function from file: cryo.dm
 public override bool update_remote_sight(Mob user = null)
 {
     return(false);
 }
Example #32
0
 public Mob GetMob(int id)
     => Mob.Parse(WZ.Resolve($"String/Mob/{id}"));
Example #33
0
        // Function from file: human.dm
        public override void persistant_inventory_update(  )
        {
            Mob H = null;


            if (!(this.mymob != null))
            {
                return;
            }
            H = this.mymob;

            if (this.hud_shown)
            {
                if (Lang13.Bool(((dynamic)H).s_store))
                {
                    ((dynamic)H).s_store.screen_loc = "CENTER-5:10,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).s_store);
                }

                if (Lang13.Bool(((dynamic)H).wear_id))
                {
                    ((dynamic)H).wear_id.screen_loc = "CENTER-4:12,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).wear_id);
                }

                if (Lang13.Bool(((dynamic)H).belt))
                {
                    ((dynamic)H).belt.screen_loc = "CENTER-3:14,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).belt);
                }

                if (Lang13.Bool(((dynamic)H).back))
                {
                    ((dynamic)H).back.screen_loc = "CENTER-2:14,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).back);
                }

                if (Lang13.Bool(((dynamic)H).l_store))
                {
                    ((dynamic)H).l_store.screen_loc = "CENTER+1:18,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).l_store);
                }

                if (Lang13.Bool(((dynamic)H).r_store))
                {
                    ((dynamic)H).r_store.screen_loc = "CENTER+2:20,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).r_store);
                }
            }
            else
            {
                if (Lang13.Bool(((dynamic)H).s_store))
                {
                    ((dynamic)H).s_store.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).wear_id))
                {
                    ((dynamic)H).wear_id.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).belt))
                {
                    ((dynamic)H).belt.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).back))
                {
                    ((dynamic)H).back.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).l_store))
                {
                    ((dynamic)H).l_store.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).r_store))
                {
                    ((dynamic)H).r_store.screen_loc = null;
                }
            }

            if (this.hud_version != 3)
            {
                if (Lang13.Bool(H.r_hand))
                {
                    H.r_hand.screen_loc = "CENTER:-16,SOUTH:5";
                    H.client.screen.Add(H.r_hand);
                }

                if (Lang13.Bool(H.l_hand))
                {
                    H.l_hand.screen_loc = "CENTER: 16,SOUTH:5";
                    H.client.screen.Add(H.l_hand);
                }
            }
            else
            {
                if (Lang13.Bool(H.r_hand))
                {
                    H.r_hand.screen_loc = null;
                }

                if (Lang13.Bool(H.l_hand))
                {
                    H.l_hand.screen_loc = null;
                }
            }
            return;
        }
Example #34
0
 public override Mob ExecuteOffensiveMeleeEnergyAbility(IOffensiveMeleeEnergyAbility ability, Mob mob)
 {
     throw new System.NotImplementedException();
 }
Example #35
0
 public void DeleteMob(Mob mob)
 {
     DatabaseManager.Database.DeleteObject(mob);
 }
Example #36
0
        public override void PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            Log.WarnFormat("Player {0} trying to spawn Mob #{1}.", player.Username, Metadata);

            var coordinates = GetNewCoordinatesFromFace(blockCoordinates, face);

            Mob mob = null;

            EntityType type = (EntityType)Metadata;

            switch (type)
            {
            case EntityType.Chicken:
                mob = new Chicken(world);
                break;

            case EntityType.Cow:
                mob = new Cow(world);
                break;

            case EntityType.Pig:
                mob = new Pig(world);
                break;

            case EntityType.Sheep:
                mob = new Sheep(world);
                break;

            case EntityType.Wolf:
                mob = new Wolf(world)
                {
                    Owner = player
                };
                break;

            case EntityType.Villager:
                mob = new Villager(world);
                break;

            case EntityType.MushroomCow:
                mob = new MushroomCow(world);
                break;

            case EntityType.Squid:
                mob = new Squid(world);
                break;

            case EntityType.Rabbit:
                mob = new Rabbit(world);
                break;

            case EntityType.Bat:
                mob = new Bat(world);
                break;

            case EntityType.IronGolem:
                mob = new IronGolem(world);
                break;

            case EntityType.SnowGolem:
                mob = new SnowGolem(world);
                break;

            case EntityType.Ocelot:
                mob = new Ocelot(world);
                break;

            case EntityType.Zombie:
                mob = new Zombie(world);
                break;

            case EntityType.Creeper:
                mob = new Creeper(world);
                break;

            case EntityType.Skeleton:
                mob = new Skeleton(world);
                break;

            case EntityType.Spider:
                mob = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                mob = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                mob = new Slime(world);
                break;

            case EntityType.Enderman:
                mob = new Enderman(world);
                break;

            case EntityType.Silverfish:
                mob = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                mob = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                mob = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                mob = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                mob = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                mob = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                mob = new Witch(world);
                break;

            case EntityType.Stray:
                mob = new Stray(world);
                break;

            case EntityType.Husk:
                mob = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                mob = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                mob = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                mob = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                var random = new Random();
                mob = new Horse(world, random.NextDouble() < 0.10, random);
                break;

            case EntityType.PolarBear:
                mob = new PolarBear(world);
                break;

            case EntityType.Shulker:
                mob = new Shulker(world);
                break;

            case EntityType.Dragon:
                mob = new Dragon(world);
                break;

            case EntityType.SkeletonHorse:
                mob = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                mob = new Wither(world);
                break;

            case EntityType.Evoker:
                mob = new Evoker(world);
                break;

            case EntityType.Vindicator:
                mob = new Vindicator(world);
                break;

            case EntityType.Vex:
                mob = new Vex(world);
                break;

            case EntityType.Npc:
                mob = new PlayerMob("test", world);
                break;
            }

            if (mob == null)
            {
                return;
            }

            mob.KnownPosition = new PlayerLocation(coordinates.X, coordinates.Y, coordinates.Z);
            mob.NoAi          = true;
            mob.SpawnEntity();

            Log.WarnFormat("Player {0} spawned Mob #{1}.", player.Username, Metadata);

            if (player.GameMode == GameMode.Survival)
            {
                var itemInHand = player.Inventory.GetItemInHand();
                itemInHand.Count--;
                player.Inventory.SetInventorySlot(player.Inventory.InHandSlot, itemInHand);
            }
        }
Example #37
0
 public JumpState(Mob mob)
 {
     _mob = mob;
 }
Example #38
0
 // Function from file: alien_powers.dm
 public virtual bool fire(Mob user = null)
 {
     return(true);
 }
Example #39
0
 public PanicBehaviorNew(Mob entity, int duration, double speedMultiplier) : base(entity, speedMultiplier, 1)
 {
     _entity   = entity;
     _duration = duration;
     _timeLeft = duration;
 }
Example #40
0
 public override void ComputeAdditionalThrashMobData(Mob mob, ParsedLog log)
 {
 }
Example #41
0
        /// <summary>
        /// Deletes all current textures
        /// </summary>
        public static void Reset()
        {
            //Texs
            foreach (DictionaryEntry ent in m_ColorTextures)
            {
                if (ent.Value != null)
                {
                    Texture tex = (Texture)ent.Value;
                    tex.Dispose();
                    tex = null;
                }
            }

            foreach (DictionaryEntry ent in m_Textures)
            {
                if (ent.Value != null)
                {
                    Texture tex = (Texture)ent.Value;
                    tex.Dispose();
                    tex = null;
                }
            }

            if (m_NPC != null)
            {
                NPC.Dispose();
                NPC = null;
            }
            if (m_Null != null)
            {
                Null.Dispose();
                Null = null;
            }
            if (m_Mob != null)
            {
                Mob.Dispose();
                Mob = null;
            }

            if (m_AreaCircle != null)
            {
                AreaCircle.Dispose();
                AreaCircle = null;
            }

            if (m_AreaSquare != null)
            {
                AreaSquare.Dispose();
                AreaSquare = null;
            }

            if (m_DefaultObject != null)
            {
                DefaultObject.Dispose();
                DefaultObject = null;
            }

            m_ColorTextures.Clear();
            m_Textures.Clear();
            GC.Collect();
        }
Example #42
0
 public override Mob ExecuteCCMeleeAbility(ICCMeleeAbility ability, Mob mob)
 {
     throw new System.NotImplementedException();
 }
Example #43
0
        public void Summon(Player player, EntityTypeEnum entityType, bool noAi = true, BlockPos spawnPos = null)
        {
            EntityType petType;

            try
            {
                petType = (EntityType)Enum.Parse(typeof(EntityType), entityType.Value, true);
            }
            catch (ArgumentException e)
            {
                return;
            }

            if (!Enum.IsDefined(typeof(EntityType), petType))
            {
                player.SendMessage("No entity found");
                return;
            }

            var coordinates = player.KnownPosition;

            if (spawnPos != null)
            {
                if (spawnPos.XRelative)
                {
                    coordinates.X += spawnPos.X;
                }
                else
                {
                    coordinates.X = spawnPos.X;
                }

                if (spawnPos.YRelative)
                {
                    coordinates.Y += spawnPos.Y;
                }
                else
                {
                    coordinates.Y = spawnPos.Y;
                }

                if (spawnPos.ZRelative)
                {
                    coordinates.Z += spawnPos.Z;
                }
                else
                {
                    coordinates.Z = spawnPos.Z;
                }
            }

            var world = player.Level;

            Mob mob = null;

            EntityType type = (EntityType)(int)petType;

            switch (type)
            {
            case EntityType.Chicken:
                mob = new Chicken(world);
                break;

            case EntityType.Cow:
                mob = new Cow(world);
                break;

            case EntityType.Pig:
                mob = new Pig(world);
                break;

            case EntityType.Sheep:
                mob = new Sheep(world);
                break;

            case EntityType.Wolf:
                mob = new Wolf(world)
                {
                    Owner = player
                };
                break;

            case EntityType.Villager:
                mob = new Villager(world);
                break;

            case EntityType.MushroomCow:
                mob = new MushroomCow(world);
                break;

            case EntityType.Squid:
                mob = new Squid(world);
                break;

            case EntityType.Rabbit:
                mob = new Rabbit(world);
                break;

            case EntityType.Bat:
                mob = new Bat(world);
                break;

            case EntityType.IronGolem:
                mob = new IronGolem(world);
                break;

            case EntityType.SnowGolem:
                mob = new SnowGolem(world);
                break;

            case EntityType.Ocelot:
                mob = new Ocelot(world);
                break;

            case EntityType.Zombie:
                mob = new Zombie(world);
                break;

            case EntityType.Creeper:
                mob = new Creeper(world);
                break;

            case EntityType.Skeleton:
                mob = new Skeleton(world);
                break;

            case EntityType.Spider:
                mob = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                mob = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                mob = new Slime(world);
                break;

            case EntityType.Enderman:
                mob = new Enderman(world);
                break;

            case EntityType.Silverfish:
                mob = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                mob = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                mob = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                mob = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                mob = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                mob = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                mob = new Witch(world);
                break;

            case EntityType.Stray:
                mob = new Stray(world);
                break;

            case EntityType.Husk:
                mob = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                mob = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                mob = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                mob = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                mob = new Horse(world);
                break;

            case EntityType.PolarBear:
                mob = new PolarBear(world);
                break;

            case EntityType.Shulker:
                mob = new Shulker(world);
                break;

            case EntityType.Dragon:
                mob = new Dragon(world);
                break;

            case EntityType.SkeletonHorse:
                mob = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                mob = new Mob(EntityType.Wither, world);
                break;

            case EntityType.Npc:
                mob = new PlayerMob("test", world);
                break;
            }

            if (mob == null)
            {
                return;
            }
            mob.NoAi = noAi;
            var direction = Vector3.Normalize(player.KnownPosition.GetHeadDirection()) * 1.5f;

            mob.KnownPosition = new PlayerLocation(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z, coordinates.HeadYaw, coordinates.Yaw);
            mob.SpawnEntity();
        }
Example #44
0
 // Function from file: musician.dm
 public override void updateDialog(Mob user = null)
 {
     this.instrumentObj.interact(user);
     return;
 }
Example #45
0
        /// <summary>
        /// Load from Database override to clone objects from original Region.
        /// Loads Objects, Mobs, Areas from Database using "SkinID"
        /// </summary>
        public override void LoadFromDatabase(Mob[] mobObjs, ref long mobCount, ref long merchantCount, ref long itemCount, ref long bindCount)
        {
            if (!LoadObjects)
            {
                return;
            }

            Assembly gasm       = Assembly.GetAssembly(typeof(GameServer));
            var      staticObjs = GameServer.Database.SelectObjects <WorldObject>("Region = " + Skin);
            var      areaObjs   = GameServer.Database.SelectObjects <DBArea>("Region = " + Skin);


            int count = mobObjs.Length + staticObjs.Count;

            if (count > 0)
            {
                PreAllocateRegionSpace(count + 100);
            }

            int myItemCount     = staticObjs.Count;
            int myMobCount      = 0;
            int myMerchantCount = 0;

            string allErrors = string.Empty;

            if (mobObjs.Length > 0)
            {
                foreach (Mob mob in mobObjs)
                {
                    GameNPC myMob = null;
                    string  error = string.Empty;

                    // Default Classtype
                    string classtype = ServerProperties.Properties.GAMENPC_DEFAULT_CLASSTYPE;

                    // load template if any
                    INpcTemplate template = null;
                    if (mob.NPCTemplateID != -1)
                    {
                        template = NpcTemplateMgr.GetTemplate(mob.NPCTemplateID);
                    }


                    if (mob.Guild.Length > 0 && mob.Realm >= 0 && mob.Realm <= (int)eRealm._Last)
                    {
                        Type type = ScriptMgr.FindNPCGuildScriptClass(mob.Guild, (eRealm)mob.Realm);
                        if (type != null)
                        {
                            try
                            {
                                myMob = (GameNPC)type.Assembly.CreateInstance(type.FullName);
                            }
                            catch (Exception e)
                            {
                                if (log.IsErrorEnabled)
                                {
                                    log.Error("LoadFromDatabase", e);
                                }
                            }
                        }
                    }


                    if (myMob == null)
                    {
                        if (template != null && template.ClassType != null && template.ClassType.Length > 0 && template.ClassType != Mob.DEFAULT_NPC_CLASSTYPE && template.ReplaceMobValues)
                        {
                            classtype = template.ClassType;
                        }
                        else if (mob.ClassType != null && mob.ClassType.Length > 0 && mob.ClassType != Mob.DEFAULT_NPC_CLASSTYPE)
                        {
                            classtype = mob.ClassType;
                        }

                        try
                        {
                            myMob = (GameNPC)gasm.CreateInstance(classtype, false);
                        }
                        catch
                        {
                            error = classtype;
                        }

                        if (myMob == null)
                        {
                            foreach (Assembly asm in ScriptMgr.Scripts)
                            {
                                try
                                {
                                    myMob = (GameNPC)asm.CreateInstance(classtype, false);
                                    error = string.Empty;
                                }
                                catch
                                {
                                    error = classtype;
                                }

                                if (myMob != null)
                                {
                                    break;
                                }
                            }

                            if (myMob == null)
                            {
                                myMob = new GameNPC();
                                error = classtype;
                            }
                        }
                    }

                    if (!allErrors.Contains(error))
                    {
                        allErrors += " " + error + ",";
                    }

                    if (myMob != null)
                    {
                        try
                        {
                            Mob clone = (Mob)mob.Clone();
                            clone.AllowAdd    = false;
                            clone.AllowDelete = false;
                            clone.Region      = this.ID;

                            myMob.LoadFromDatabase(clone);

                            if (myMob is GameMerchant)
                            {
                                myMerchantCount++;
                            }
                            else
                            {
                                myMobCount++;
                            }
                        }
                        catch (Exception e)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("Failed: " + myMob.GetType().FullName + ":LoadFromDatabase(" + mob.GetType().FullName + ");", e);
                            }
                            throw;
                        }

                        myMob.AddToWorld();
                    }
                }
            }

            if (staticObjs.Count > 0)
            {
                foreach (WorldObject item in staticObjs)
                {
                    WorldObject itemclone = (WorldObject)item.Clone();
                    itemclone.AllowAdd    = false;
                    itemclone.AllowDelete = false;
                    itemclone.Region      = this.ID;

                    GameStaticItem myItem;
                    if (!string.IsNullOrEmpty(itemclone.ClassType))
                    {
                        myItem = gasm.CreateInstance(itemclone.ClassType, false) as GameStaticItem;
                        if (myItem == null)
                        {
                            foreach (Assembly asm in ScriptMgr.Scripts)
                            {
                                try
                                {
                                    myItem = (GameStaticItem)asm.CreateInstance(itemclone.ClassType, false);
                                }
                                catch { }
                                if (myItem != null)
                                {
                                    break;
                                }
                            }
                            if (myItem == null)
                            {
                                myItem = new GameStaticItem();
                            }
                        }
                    }
                    else
                    {
                        myItem = new GameStaticItem();
                    }

                    myItem.AddToWorld();
                }
            }

            int areaCnt = 0;

            // Add missing area
            foreach (DBArea area in areaObjs)
            {
                // Don't bind in instance.
                if (area.ClassType.Equals("DOL.GS.Area+BindArea"))
                {
                    continue;
                }

                // clone DB object.
                DBArea newDBArea = ((DBArea)area.Clone());
                newDBArea.AllowAdd = false;
                newDBArea.Region   = this.ID;
                // Instantiate Area with cloned DB object and add to region
                try
                {
                    AbstractArea newArea = (AbstractArea)gasm.CreateInstance(newDBArea.ClassType, false);
                    newArea.LoadFromDatabase(newDBArea);
                    newArea.Sound        = newDBArea.Sound;
                    newArea.CanBroadcast = newDBArea.CanBroadcast;
                    newArea.CheckLOS     = newDBArea.CheckLOS;
                    this.AddArea(newArea);
                    areaCnt++;
                }
                catch
                {
                    log.Warn("area type " + area.ClassType + " cannot be created, skipping");
                    continue;
                }
            }

            if (myMobCount + myItemCount + myMerchantCount > 0)
            {
                if (log.IsInfoEnabled)
                {
                    log.Info(String.Format("AdventureWingInstance: {0} ({1}) loaded {2} mobs, {3} merchants, {4} items, {5}/{6} areas from DB ({7})", Description, ID, myMobCount, myMerchantCount, myItemCount, areaCnt, areaObjs.Count, TimeManager.Name));
                }

                log.Debug("Used Memory: " + GC.GetTotalMemory(false) / 1024 / 1024 + "MB");

                if (allErrors != string.Empty)
                {
                    log.Error("Error loading the following NPC ClassType(s), GameNPC used instead:" + allErrors.TrimEnd(','));
                }

                Thread.Sleep(0);  // give up remaining thread time to other resources
            }
            mobCount      += myMobCount;
            merchantCount += myMerchantCount;
            itemCount     += myItemCount;
        }
Example #46
0
 public override void _Ready()
 {
     OwnerMob     = (Mob)Owner;
     ActionsStack = new Stack <AbstractAction>();
 }
Example #47
0
 // Function from file: cryo.dm
 public override bool relaymove(Mob user = null, int?direction = null)
 {
     this.container_resist(user);
     return(false);
 }
Example #48
0
        public void Spawn(Player player, int mobTypeId)
        {
            Mob mob = new Mob(mobTypeId, player.Level);

            mob.SpawnEntity();
        }
Example #49
0
    static public bool PlayerAttacks(Coord mp, THING weap, bool thrown)
    {
        THING  tp;
        bool   did_hit = true;
        string mname;
        char   ch;

        /*
         * Find the monster we want to fight
         */
        tp = Dungeon.GetMonster(mp.y, mp.x);

        //since we are fighting, things are not Quiet... so no healing takes place
        Agent.Quiet = 0;
        Mob.runto(mp);

        //if it was really a xeroc, let him know
        ch = '\0';
        if (tp.MonsType == 'X' && tp.t_disguise != 'X' && !on(Agent.Plyr, Mob.ISBLIND))
        {
            tp.t_disguise = 'X';
            S.Log(choose_str(
                      "heavy!  That's a nasty critter!",
                      "wait!  That's a xeroc!"));

            if (!thrown)
            {
                return(false);
            }
        }

        mname   = GetMonsterName(tp);
        did_hit = false;
        if (roll_em(Agent.Plyr, tp, weap, thrown))
        {
            did_hit = false;
            if (thrown)
            {
                hitRanged(weap, mname, Agent.Terse);
            }
            else
            {
                hitMelee(null, mname, Agent.Terse);
            }

            if (on(Agent.Plyr, Mob.CANHUH))
            {
                did_hit             = true;
                tp.t_flags         |= Mob.ISHUH;
                Agent.Plyr.t_flags &= ~Mob.CANHUH;
                R14.AddToLog("your hands stop glowing {0}", Potion.GetColor("red"));
            }
            if (tp.Stats.Hp <= 0)
            {
                killed(tp, true);
            }
            else if (did_hit && !on(Agent.Plyr, Mob.ISBLIND))
            {
                R14.AddToLog("{0} appears confused", mname);
            }
            did_hit = true;
        }
        else
        if (thrown)
        {
            missRanged(weap, mname, Agent.Terse);
        }
        else
        {
            missMelee(null, mname, Agent.Terse);
        }
        return(did_hit);
    }
Example #50
0
 public void Attack(Mob mob)
 {
     Console.WriteLine("Attack");
     mob.TakeDamage(120);
 }
        bool Up, Down, Right, Left, IsAnotherPage; //Checagem da direção que o personagem está indo


        public void StoreChars(Mob EnemyMob)
        {
            MobAndChar.Add(EnemyMob);
        }
Example #52
0
 public override void skillFixedUpdate(Mob mob)
 {
     if (timer > Time.fixedTime)
         mob.gameObject.GetComponent<Rigidbody2D>().velocity = direction * 70 * (timer-Time.fixedTime)/0.2f;
 }
Example #53
0
        // Function from file: paper.dm
        public dynamic parsepencode(dynamic t = null, dynamic P = null, Mob user = null, bool?iscrayon = null)
        {
            iscrayon = iscrayon ?? false;

            dynamic C         = null;
            int     laststart = 0;
            int     i         = 0;


            if (Lang13.Length(t) < 1)
            {
                return(null);
            }
            t = GlobalFuncs.replacetext(t, "[center]", "<center>");
            t = GlobalFuncs.replacetext(t, "[/center]", "</center>");
            t = GlobalFuncs.replacetext(t, "[br]", "<BR>");
            t = GlobalFuncs.replacetext(t, "[b]", "<B>");
            t = GlobalFuncs.replacetext(t, "[/b]", "</B>");
            t = GlobalFuncs.replacetext(t, "[i]", "<I>");
            t = GlobalFuncs.replacetext(t, "[/i]", "</I>");
            t = GlobalFuncs.replacetext(t, "[u]", "<U>");
            t = GlobalFuncs.replacetext(t, "[/u]", "</U>");
            t = GlobalFuncs.replacetext(t, "[large]", "<font size=\"4\">");
            t = GlobalFuncs.replacetext(t, "[/large]", "</font>");
            t = GlobalFuncs.replacetext(t, "[sign]", "<font face=\"" + "Times New Roman" + "\"><i>" + user.real_name + "</i></font>");
            t = GlobalFuncs.replacetext(t, "[field]", "<span class=\"paper_field\"></span>");

            if (!(iscrayon == true))
            {
                t = GlobalFuncs.replacetext(t, "[*]", "<li>");
                t = GlobalFuncs.replacetext(t, "[hr]", "<HR>");
                t = GlobalFuncs.replacetext(t, "[small]", "<font size = \"1\">");
                t = GlobalFuncs.replacetext(t, "[/small]", "</font>");
                t = GlobalFuncs.replacetext(t, "[list]", "<ul>");
                t = GlobalFuncs.replacetext(t, "[/list]", "</ul>");
                t = "<font face=\"" + "Verdana" + "\" color=" + P.colour + ">" + t + "</font>";
            }
            else
            {
                C = P;
                t = GlobalFuncs.replacetext(t, "[*]", "");
                t = GlobalFuncs.replacetext(t, "[hr]", "");
                t = GlobalFuncs.replacetext(t, "[small]", "");
                t = GlobalFuncs.replacetext(t, "[/small]", "");
                t = GlobalFuncs.replacetext(t, "[list]", "");
                t = GlobalFuncs.replacetext(t, "[/list]", "");
                t = "<font face=\"" + "Comic Sans MS" + "\" color=" + C.paint_color + "><b>" + t + "</b></font>";
            }
            laststart = 1;

            while (true)
            {
                i = String13.FindIgnoreCase(t, "<span class=\"paper_field\">", laststart, 0);

                if (i == 0)
                {
                    break;
                }
                laststart = i + 1;
                this.fields++;
            }
            return(t);
        }
 public Inventory(Mob aParent)
 {
     parent = aParent;
     items  = new List <InventoryItem>();
 }
Example #55
0
 public static void AddHunt(Mob mob)
 {
     if (hunted.ContainsKey(mob.ID))
         hunted[mob.ID]++;
     else
         hunted.Add(mob.ID, 1);
 }
 public virtual void ComputeAdditionalThrashMobData(Mob mob, ParsedLog log)
 {
 }
Example #57
0
 public void UpdateEntity(SpawnMob spawn)
 {
     Mob m = null;
     lock (entities)
     {
         if (entities.ContainsKey(spawn.EID))
             m = entities[spawn.EID] as Mob;
         if (m == null)
         {
             m = new Mob(spawn.EID, spawn.Type);
             entities[spawn.EID] = m;
         }
     }
     m.Update(spawn);
 }
Example #58
0
        // Function from file: human.dm
        public override void hidden_inventory_update(  )
        {
            Mob H = null;


            if (!(this.mymob != null))
            {
                return;
            }
            H = this.mymob;

            if (this.inventory_shown && this.hud_shown)
            {
                if (Lang13.Bool(((dynamic)H).shoes))
                {
                    ((dynamic)H).shoes.screen_loc = "WEST+1:8,SOUTH:5";
                    H.client.screen.Add(((dynamic)H).shoes);
                }

                if (Lang13.Bool(((dynamic)H).gloves))
                {
                    ((dynamic)H).gloves.screen_loc = "WEST+2:10,SOUTH+1:7";
                    H.client.screen.Add(((dynamic)H).gloves);
                }

                if (Lang13.Bool(((dynamic)H).ears))
                {
                    ((dynamic)H).ears.screen_loc = "WEST+2:10,SOUTH+2:9";
                    H.client.screen.Add(((dynamic)H).ears);
                }

                if (Lang13.Bool(((dynamic)H).glasses))
                {
                    ((dynamic)H).glasses.screen_loc = "WEST:6,SOUTH+2:9";
                    H.client.screen.Add(((dynamic)H).glasses);
                }

                if (Lang13.Bool(((dynamic)H).w_uniform))
                {
                    ((dynamic)H).w_uniform.screen_loc = "WEST:6,SOUTH+1:7";
                    H.client.screen.Add(((dynamic)H).w_uniform);
                }

                if (Lang13.Bool(((dynamic)H).wear_suit))
                {
                    ((dynamic)H).wear_suit.screen_loc = "WEST+1:8,SOUTH+1:7";
                    H.client.screen.Add(((dynamic)H).wear_suit);
                }

                if (Lang13.Bool(((dynamic)H).wear_mask))
                {
                    ((dynamic)H).wear_mask.screen_loc = "WEST+1:8,SOUTH+2:9";
                    H.client.screen.Add(((dynamic)H).wear_mask);
                }

                if (Lang13.Bool(((dynamic)H).head))
                {
                    ((dynamic)H).head.screen_loc = "WEST+1:8,SOUTH+3:11";
                    H.client.screen.Add(((dynamic)H).head);
                }
            }
            else
            {
                if (Lang13.Bool(((dynamic)H).shoes))
                {
                    ((dynamic)H).shoes.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).gloves))
                {
                    ((dynamic)H).gloves.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).ears))
                {
                    ((dynamic)H).ears.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).glasses))
                {
                    ((dynamic)H).glasses.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).w_uniform))
                {
                    ((dynamic)H).w_uniform.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).wear_suit))
                {
                    ((dynamic)H).wear_suit.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).wear_mask))
                {
                    ((dynamic)H).wear_mask.screen_loc = null;
                }

                if (Lang13.Bool(((dynamic)H).head))
                {
                    ((dynamic)H).head.screen_loc = null;
                }
            }
            return;
        }
 // Function from file: camera_bug.dm
 public override void on_unset_machine(Mob user = null)
 {
     user.reset_perspective(null);
     return;
 }
Example #60
0
 // Function from file: core_removal.dm
 public override int preop(dynamic user = null, Mob target = null, string target_zone = null, dynamic tool = null, Surgery surgery = null)
 {
     ((Ent_Static)user).visible_message("" + user + " begins to extract a core from " + target + ".", "<span class='notice'>You begin to extract a core from " + target + "...</span>");
     return(0);
 }