Пример #1
0
void Interface::Basic::EventCastSpell(void)
{
    Heroes* hero = GetFocusHeroes();

    if(hero)
    {
	const Spell spell = hero->OpenSpellBook(SpellBook::ADVN, true);
	// apply cast spell
	if(spell.isValid())
	{
	    hero->ActionSpellCast(spell);
	    iconsPanel.SetRedraw();
	}
    }
}
Пример #2
0
bool HeroBase::CanTranscribeScroll(const Artifact & art) const
{
    Spell spell = art.GetSpell();

    if(spell.isValid() && CanCastSpell(spell))
    {
	int learning = GetLevelSkill(Skill::Secondary::LEARNING);

	return ((3 <  spell.Level() && Skill::Level::EXPERT == learning) ||
	    (3 == spell.Level() && Skill::Level::ADVANCED <= learning) ||
	    (3 > spell.Level() && Skill::Level::BASIC <= learning));
    }

    return false;
}
Пример #3
0
void HeroBase::LoadDefaults(int type, int race)
{
    if(Race::ALL & race)
    {
	// fixed default primary skills
	Skill::Primary::LoadDefaults(type, race);

	// fixed default spell
	switch(type)
	{
	    case HeroBase::CAPTAIN:
	    {
		// force add spell book
		SpellBookActivate();

		Spell spell = Skill::Primary::GetInitialSpell(race);
		if(spell.isValid())
		    AppendSpellToBook(spell, true);
	    }
    	    break;

	    case HeroBase::HEROES:
	    {
		Spell spell = Skill::Primary::GetInitialSpell(race);
		if(spell.isValid())
		{
		    SpellBookActivate();
		    AppendSpellToBook(spell, true);
		}
	    }
    	    break;

	    default: break;
	}
    }
}
Пример #4
0
void HeroBase::TranscribeScroll(const Artifact & art)
{
    Spell spell = art.GetSpell();

    if(spell.isValid())
    {
	// add spell
	spell_book.Append(spell);

	// remove art
	bag_artifacts.RemoveScroll(art);

	// reduce mp and resource
	SpellCasted(spell);
    }
}