How to really use the shield


#1

I’m assuming that the shield does not automatically passively block some of the time, and it needs to be activated in the code.

I’ve read in the forum that shield can’t be used while moving, so does it deactivate when the hero walks towards a new enemy?

Would this be the correct way to switch back and forth between shield and attack (to increase longevity)?

    if(enemy){
        var distance = this.distanceTo(enemy);
        if (distance < 21 && this.isReady("electrocute")){
            this.electrocute(enemy);
        } 
        else if (distance < 4 && this.isReady("bash")){
            this.bash(enemy);
        }
        else {
            loop{
                this.shield();
                this.attack(enemy);
            }
        }

Is it possible to block incoming missiles like spears in the code using shield and a good pair of glasses between attacks?


#2

its possible, but (!) shield takes a amount of time. That means Shield works kind of this:
you may wear it all the time, but it only gives you some amount of health. You can use Bash, so a kind of an attack with your shield. The shield does not shield you. Its like “hanging by your side” so if you dont use the shield it does not protect you. Like in Real life if your shield is in your left hand and attack comes from right it doesnt help you. If you now use your shield function (self.shield() ) you protect an amount of total damage (sth like 80%) so if your enemy hit you with 100dmg you only take 20 (100-100*0.8). The ability to shield yourself takes an amount of seconds, but shields you the whole time.
So in your code when electrocute and bash arent ready he first will shield you and than will attack, but while attacking he isnt shieldet. Because if you shield yourself he cant do anything else.
Does this make it clear?


#3

shield() is like move(), if you issue any other command OR stop issuing the move() command you stop moving. Same with shield() so you either are Actively shielding or you’re not at all.

At best loop { shield attack } (FOREVER), would protect you every other action, but you’d only attack every other as well AND chances are your attack takes more time than the shield action does, so you are protected for short time and vulnerable for long time…


#4

I’ve only ever used shield to reduce damage for an extended period of time but otherwise never used it in regular fighting. Using shield means less moving and regular attacks, right? Unless regular attack has a cooldown (?). However, there might be some situations where it is more effective to shield while waiting for an ability to refresh, but that takes extra code and consideration.

I’ve also considered using it to block missiles. That should be worth trying since Tharin seems too slow to dodge most missiles. Perhaps check if there are any ranged attacks that are nearby and travelling in the same direction. Again, more code.