Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool BuildManaFountain(Elf elf)
- {
- int i = 2;
- bool right = Utility.game.GetMyCastle().GetLocation().Col > Utility.game.GetEnemyCastle().GetLocation().Col;
- bool up = Utility.game.GetMyCastle().GetLocation().Row <= Utility.game.Rows/2;
- if(Utility.manaCount < 3)
- {
- Location loc = Utility.game.GetMyCastle().GetLocation();
- int manaRadius = Utility.game.ManaFountainSize;
- Location manaFountain = new Location(up ? manaRadius : Utility.game.Rows - manaRadius, 0);
- manaFountain.Col = right ? loc.Col - Utility.game.CastleSize - manaRadius : loc.Col + manaRadius;
- int defCol = manaFountain.Col;
- int nextRow = manaFountain.Row;
- i = 0;
- while(!Utility.game.CanBuildManaFountainAt(manaFountain) && Utility.game.InMap(manaFountain))
- {
- if(i % 2 == 0)
- {
- manaFountain.Col = defCol - i/2;
- manaFountain.Row = nextRow;
- nextRow += up ? manaRadius*2 : -manaRadius*2;
- }
- else
- {
- manaFountain.Col += right ? -manaRadius*2-1 : manaRadius*2+1;
- }
- i++;
- }
- Utility.Log("Going to : " + manaFountain + ", i = " + i.ToString());
- if (elf.GetLocation().Equals(manaFountain))
- {
- if(elf.CanBuildManaFountain())
- {
- elf.BuildManaFountain();
- Utility.manaCount++;
- }
- else
- Utility.StorageMana = Utility.game.ManaFountainCost;
- Utility.portalLoc = manaFountain;
- }
- else if(Utility.game.InMap(manaFountain))
- elf.MoveTo(manaFountain);
- else return false;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement