Beginner's Guide

Beginner's Guide

> Encyclopedia

> _Before reading this introduction to the game, remember this: This help contains many pages that explain different concepts. When a word appears in blue, it is a clickable link. These links will take you to other pages, where you can find valuable information. So do not hesitate to take the opportunity to discover the different notions of the game. For example, this page will not explain how the weapons in the game work from top to bottom, but you will certainly find a link on the word "Weapon" which will allow you to learn more! Enjoy your reading!_

Welcome to Leek Wars!

Before coding, strategizing or talking nonsense on the chat, we will have to learn a little more about Leek Wars.

In this strange game, you will be a Farmer, a man or a woman entirely devoted to the task of improving their little protégés. But you won't be just any farmer, you will have to take care of Leeks! Did you already understand that? Ah.

Your leeks are not just vegetables. They can move (Nobody knows how), and most importantly, they can fight. Via an arsenal of Weapons and Chips to cast spells, these leeks are veritable war machines. They can even summon Bulbs to help them in their battles. They also have Characteristics, which make them more or less effective in certain areas. On the other hand, they knew how to keep a sensitive soul and are victims of fashion, they sometimes change color and put on hats.

You will start calmly by attending to a single skinny leek. But it will grow fast, and with experience you can raise up to 4 leeks (Leek Wars farmers have been prioritizing quality over quantity since 1853).

But it's not enough to launch your leeks into battle, you must first teach them to fight! Leek Wars is above all a programming game, so you will have to create an artificial intelligence, an AI. So, the AI is a kind of script that your leek will run every game turn and tell it what to do.

Are you ready? So let's start at... the beginning.

Distribute your capital

Your leeks gain Capital Points when they level up. Fortunately, it starts with 50 points! The first thing to do is therefore to distribute these points, but not just anyhow!

Go to your Leek's page, this is the first tab of the navigation bar, the one that bears the name of your Leek. You will find various information there, but the ones that interest us are these:

!Level 1 points

Your leek being level 1, I strongly advise you to distribute these points in Life !Life and Strength !Strength. Other characteristics require Chips that you haven't unlocked yet in order to be useful. The Life simply increases the life points of your leek, useful for not dying too quickly. And the Strength allows you to inflict more damage with your Weapons.

There are two skills that you should also consider. TP !TP are the action points of your Leek, this determines the number of actions it can do per turn. For example, equipping a weapon consumes 1 TP, firing the Pistol consumes 3 TP. MP !MP determines how many cells your Leek can move in one turn.

If you want to know more about the different characteristics, it's here: Characteristics.

On your Leek page, you can also see that it is equipped with a Pistol. You will need to gain a few levels before you can unlock other Weapons and Chips.

Keep your Leek ready, let's take care of his AI!

AI

Now go to the "Editor" tab. You will find a first AI there, called "Untitled". It contains a minimal code that will allow your leek to move towards his opponent and attack him.

Lines that start with // allow you to comment your code. These are simply sentences to clarify the code, not instructions that your Leek will follow.

The first instruction is very important, Weapons must be picked up to be used. You can have 2-4 weapons on a leek' inventory depending on its level. It carries several weapons but it can only use the one it has in his hands. Thus, you must use the setWeapon function to change the weapon your leek has in its hands. Warning, changing the current weapon consumes 1 TP, even if you do so when you already have this weapon in your hands. So it's a good idea to only do this setWeapon when necessary. To do this, all you need is a condition using the function getWeapon which returns the weapon currently in use.

Next, you need a target. This is where getNearestEnemy comes in. This function returns the nearest opponent that you store in the variable enemy. Variations exist to find out allies or to get the farthest opponent rather than the closest.

Then you want to moveToward which allows you to move towards a leek of as many MP as possible.

Finally, the useWeapon function allows you to use the weapon currently in your leek's hands on a target. If the conditions for using the weapon are met (range, sight, ...), this function consumes as many TP as it takes to use the weapon; otherwise, the function doesn't use any TP (and your leek won't shoot).

Here is the detail of this code. Keep in mind that this is not the entire fight code. This is the code that is executed every turn! Each time it is his turn to play, your leek will equip his weapon, advance towards his opponent, and attack.

Attack effectively

But you won't get very far with this code! Because this one is only a starting point, and is far from being very powerful.

On the first instruction, you equip the Pistol (WEAPON_PISTOL). Take a good look at its sheet in the Market.

The star symbol ![](/image/charac/small/tp.png) indicates the cost in TP to use this weapon once.

And you may have noticed when you distributed your Capital Points that you had 10 of them. Do you see where I'm going?

This line only makes you fire your weapon once:

Therefore, your leek will have 7 TP left after using it once. You could shoot two more times! (using 6 TP in reality, because of the setWeapon(WEAPON_PISTOL) which consumes 1)

Change the code to fire your weapon 3 times. You will inflict much more damage.

If you are new to programming, just write the instruction 3 times.

If you are experienced in coding, do it in a loop.

Use chip

From level 2, you also have access to a Chip. Those Chips, unlike weapons, do not need to be "handled". Just equip a chip on your Leek page to be able to use it.

To use a chip, use the function useChip. This takes two parameters: the chip to use and the target.

Thus, to use the Shock chip on the nearest enemy, proceed as follows:

CHIP_SHOCK is the constant of the chip Shock, you can find it on the data sheet of this chip at the Market.

Attacking fellow Leeks

Your Leek is ready for battle! It's time to go to the Garden to face other leeks!

Select a leek among the 5 proposed to face it. You gain Experience and Habs (In-game currency) when you fight in the Garden.

Every day you get 50 battles to start in the Garden. If you don't start all your fights, they accumulate up to 100. On the other hand, if you have bought fights in the Market, they are kept indefinitely.

!Garden at level 1

Conclusion

You now know everything you need to know to get started on Leek Wars.

You will now need to improve your skills as an AI developer and strategist to progress.

If this is not your first programming experience, I invite you to read this Tutorial which will allow you to familiarize yourself with the language.

Good luck, young farmer!