From 83f4b43f63960ba30e38cf5bb53cd98ae738ef74 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 26 Oct 2007 21:21:38 +0000 Subject: Redoing rev25 [ADD] DISCLAIMER [FIX] PokemonEvolution styles [ADD] Relative enumeration [DEL] pokemod/Status.{h, cpp} [DEL] pokemod/StatusEffect.{h, cpp} [FIX] Status effects will be added as needed instead of customized [FIX] Completed ItemEffects [FIX] Factored out Natures to be global [DEL] pokemod/PokemonNature.{h, cpp} [DEL] ai/Net.{h, cpp} [DEL] ai/Layer/{h, cpp} [ADD] battle/Arena.{h, cpp} [ADD] battle/Team.{h, cpp} [ADD] battle/Human.{h, cpp} [ADD] battle/Bot.{h, cpp} [ADD] battle/GhostBot.{h, cpp} [ADD] battle/Pokemon.{h, cpp} [ADD] battle/Ghost.{h, cpp} [FIX] Fixed some scope errors in pokemod [ADD] audio/audio.pro [ADD] audio/Audio.{h, cpp} [ADD] audio/AudioLibrary.{h, cpp} [ADD] audio/AudioSystem.{h, cpp} [ADD] audio/Music.{h, cpp} [ADD] audio/SoundEffect.{h, cpp} [DEL] old audio system (was in C) [FIX] Optimized some routines in pokemod [FIX] Moved global classes (Ini, Frac, Matrix, FracMatrix, Point, Flag) to general git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@27 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- battle/Ghost.cpp | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 battle/Ghost.cpp (limited to 'battle/Ghost.cpp') diff --git a/battle/Ghost.cpp b/battle/Ghost.cpp new file mode 100644 index 00000000..cf3e6dd5 --- /dev/null +++ b/battle/Ghost.cpp @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: battle/Ghost.cpp +// Purpose: Ghost used by the AI for simulations +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Tue Oct 16 2007 19:29:30 +// Copyright: ©2007 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see . +///////////////////////////////////////////////////////////////////////////// + +#include "Ghost.h" + +Ghost(const PokeMod::Pokemod* par, const unsigned s, const unsigned l, const unsigned t) : + Pokemon(par, s, l), + teamSize(t), + unknownMoves(par->GetMaxMoves()) +{ + for (unsigned i = 0; i < PokeMod::ST_End_GSC; ++i) + { + dv[i] = 0; + statExp[i] = 0; + minStats[i] = GetStat(i); + dv[i] = pokemod->GetMaxDV(); + statExp[i] = 65535; + maxStats[i] = GetStat(i); + } + Species* pkmn = pokemod->GetSpeciesByID(s); + if (pkmn->GetNumAbilities() == 1) + FeedAbility(pkmn->GetAbility(0)); +} + +void FeedAttack(const unsigned actualDamage, const unsigned stat, const unsigned otherLevel, const unsigned power, const bool isAttacker) +{ + +} + +void FeedItem(const unsigned i) +{ + items.append(i); +} + +void FeedMove(const unsigned m) +{ + if (!moves.contains(m)) + { + moves.insert(m); + --unknownMoves; + moveChances[m] = UINT_MAX; + for (QMutableMapIterator i(moveChances); i.hasNext(); i.next()) + { + if (i.value() != UINT_MAX) + { + i.value() *= unknownMoves; + i.value() /= (unknownMoves + 1); + if (!i.value()) + moveChances.erase(i); + } + } + for (QListIterator i(moveCombos); i.hasNext(); i.next()) + { + if (i.prereqs.intersect(moves).size() && !moves.contains(i.move)) + moves[i.move] *= i.chance; + } + } +} + +void FeedMoveChance(const unsigned m, const unsigned weight) +{ + moveChances[m] = weight; +} + +void FeedAbility(const unsigned a) +{ + ability = a; +} + +void UpdateHP() +{ + curHP = hpPercent * maxStats[PokeMod::ST_HP]; +} + +void SetHP(const Frac p) +{ + hpPercent = p; + UpdateHP(); +} -- cgit