/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.arconus.dicecommander.model.wizards;
import android.content.res.Resources;
import android.view.inputmethod.EditorInfo;
import com.arconus.dicecommander.Application;
import com.arconus.dicecommander.R;
import com.arconus.dicecommander.model.entities.character.Defenses;
import com.arconus.dicecommander.model.entities.character.power.ActionType;
import com.arconus.dicecommander.model.entities.character.power.AttackType;
import com.arconus.dicecommander.model.entities.character.power.PowerUsage;
import com.arconus.dicecommander.utilities.DataOrbBuilder;
import com.example.android.wizardpager.wizard.model.AbstractWizardModel;
import com.example.android.wizardpager.wizard.model.BranchPage;
import com.example.android.wizardpager.wizard.model.Page;
import com.example.android.wizardpager.wizard.model.PageList;
import com.example.android.wizardpager.wizard.model.SingleEditPage;
import com.example.android.wizardpager.wizard.model.dataorbs.SingleFixedChoicePageWithDataOrbs;
import java.util.ArrayList;
import java.util.List;
//import android.R;
public class PowerWizard extends AbstractWizardModel {
public static final int POWER_NAME_PAGE = 0;
public static final int POWER_USAGE_PAGE = 1;
public static final int POWER_ACTION_TYPE_PAGE = 2;
public static final int POWER_ATTACK_TYPE_PAGE = 3;
public static final int ATTACK_ROLL_PAGE = 4;
public static final int ATTACK_MODIFIER_PAGE = 5;
public static final int DEFENSE_TYPE_PAGE = 6;
public static final int DAMAGE_ROLL_PAGE = 7;
public static final int NUMBER_OF_DAMAGE_DICE_PAGE = 8;
public static final int DAMAGE_DIE_PAGE = 9;
public static final int DAMAGE_MODIFIER_PAGE = 10;
public PowerWizard() {
}
@Override
protected PageList onNewRootPageList() {
Resources res = Application.appContext.getResources();
List<Page> list = new ArrayList<Page>();
list.add(new SingleEditPage(this, res.getString(R.string.power_wizard_name), POWER_NAME_PAGE, EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS)
.setRequired(true));
list.add(new SingleFixedChoicePageWithDataOrbs(this, res.getString(R.string.power_wizard_usage_type), POWER_USAGE_PAGE)
.setChoices(DataOrbBuilder.buildDataOrbArray(PowerUsage.values(), res))
.setValue(DataOrbBuilder.buildDataOrb(PowerUsage.AT_WILL, res))
.setRequired(true));
list.add(new SingleFixedChoicePageWithDataOrbs(this, res.getString(R.string.power_wizard_action_type), POWER_ACTION_TYPE_PAGE)
.setChoices(DataOrbBuilder.buildDataOrbArray(ActionType.values(), res))
.setValue(DataOrbBuilder.buildDataOrb(ActionType.STANDARD, res))
.setRequired(true));
list.add(new SingleFixedChoicePageWithDataOrbs(this, res.getString(R.string.power_wizard_attack_type), POWER_ATTACK_TYPE_PAGE)
.setChoices(DataOrbBuilder.buildDataOrbArray(AttackType.values(), res))
.setRequired(true));
list.add(new BranchPage(this, res.getString(R.string.power_wizard_attack_roll_q), ATTACK_ROLL_PAGE)
.addBranch(res.getString(R.string.wizard_yes),
/*
new SingleFixedChoicePage(this, "Stat Modifiers to Attack Roll")
.setChoices("STR", "DEX", "INT", "CON", "WIS", "CHR"),*/
new SingleEditPage(this, res.getString(R.string.power_wizard_attack_modifier), ATTACK_MODIFIER_PAGE, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED)
.setRequired(true), //This can be removed when we get persistent tracking of stats
new SingleFixedChoicePageWithDataOrbs(this, res.getString(R.string.power_wizard_defense_type), DEFENSE_TYPE_PAGE)
.setChoices(DataOrbBuilder.buildDataOrbArray(Defenses.values(), res))
.setValue(DataOrbBuilder.buildDataOrb(Defenses.AC, res))
.setRequired(true))
.addBranch(res.getString(R.string.wizard_no))
.setValue(res.getString(R.string.wizard_yes)));
list.add(new BranchPage(this, res.getString(R.string.power_wizard_damage_roll_q), DAMAGE_ROLL_PAGE)
.addBranch(res.getString(R.string.wizard_yes),
new SingleEditPage(this, res.getString(R.string.power_wizard_number_of_damage_dice), NUMBER_OF_DAMAGE_DICE_PAGE, EditorInfo.TYPE_CLASS_NUMBER)
.setRequired(true),
new SingleFixedChoicePageWithDataOrbs(this, res.getString(R.string.power_wizard_damage_die_type), DAMAGE_DIE_PAGE)
.setChoices(DataOrbBuilder.buildDieSizeDataOrbArray())
.setRequired(true),
new SingleEditPage(this, res.getString(R.string.power_wizard_damage_modifier), DAMAGE_MODIFIER_PAGE, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED)
.setRequired(true))
.addBranch(res.getString(R.string.wizard_no))
.setValue(res.getString(R.string.wizard_yes)));
return new PageList(list.toArray(new Page[]{}));
}
}